webrtc-java icon indicating copy to clipboard operation
webrtc-java copied to clipboard

Question: Getting audio playback and capture devices are currently used in the OS by default

Open Stasyanych opened this issue 3 years ago • 6 comments

Thank you for a very useful library! I would like to know how to get audio devices that are currently used in the OS by default and is it possible to do this in the current version of the library? Thank you in advance for your answer.

Stasyanych avatar Sep 16 '21 05:09 Stasyanych

I started to create wiki pages for this library. There is a wiki page for media devices. Right now, the Java API does not have methods implemented to retrieve the default device of the OS. BUT, the native code does have an implementation which works at least for Windows and macOS, Linux not tested with default devices.

Will add these methods to the Java implementation.

devopvoid avatar Sep 16 '21 10:09 devopvoid

Thanks a lot for the quick response.

Stasyanych avatar Sep 16 '21 11:09 Stasyanych

@devopvoid 0.6 resolve this?

polyn0m avatar Jan 17 '22 10:01 polyn0m

The version 0.6.0 should resolve this issue.

MediaDevices.getDefaultAudioRenderDevice(); (e.g. speaker) MediaDevices.getDefaultAudioCaptureDevice(); (e.g. microphone)

Please let me know if this works for you.

devopvoid avatar Jan 17 '22 10:01 devopvoid

It works for me. I'm tested this on Win10. But on MacOS getDeafultAudioRenderDevice() return empty device name if used embedded speaker.

Stasyanych avatar Jan 17 '22 13:01 Stasyanych

Hello, dear friend! Thanks again for the great work done. I continue to investigate the WebRTC library in more detail and found the following problems with getting a list of devices. Problems concern macOS:

  1. The "deviceConnected" and "deviceDisconnected" method of the DeviceChange Listener interface returns an empty name if it has Cyrillic characters. The problem is clearly in the encoding
  2. The AudioDeviceModule method.getPlayoutDevices() returns the device names correctly, but the descriptor values are missing.
  3. The number of devices that mediaDevices and AudioDeviceModule returns is different. This leads to the fact that it is not always possible to correctly install the connected device in the DeviceChangeListener event I attach a screenshot that shows everything described above.

diff_devices

Stasyanych avatar Apr 14 '22 05:04 Stasyanych

Hello @devopvoid

This issue fix in next version?

polyn0m avatar Nov 07 '22 13:11 polyn0m

I'm on it. Will test the mac version this week and comment on this issue.

devopvoid avatar Nov 07 '22 13:11 devopvoid

The latest snapshot now works with Cyrillic and other characters.

devopvoid avatar Nov 13 '22 14:11 devopvoid

Thanks for the fix for the Cyrillic problem. Please tell me, has anything been done with the fact that all capture devices and playout devices guid returned as null when received through AudioDeviceModule? This behavior is only on MacOS. On win10 everything is fine. In our correspondence above I attached a screenshot where you can see it. Thank you in advance for the answer!

Stasyanych avatar Mar 14 '23 06:03 Stasyanych