webrtc-java
webrtc-java copied to clipboard
Question: Getting audio playback and capture devices are currently used in the OS by default
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.
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.
Thanks a lot for the quick response.
@devopvoid 0.6 resolve this?
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.
It works for me. I'm tested this on Win10. But on MacOS getDeafultAudioRenderDevice() return empty device name if used embedded speaker.
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:
- 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
- The AudioDeviceModule method.getPlayoutDevices() returns the device names correctly, but the descriptor values are missing.
- 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.
Hello @devopvoid
This issue fix in next version?
I'm on it. Will test the mac version this week and comment on this issue.
The latest snapshot now works with Cyrillic and other characters.
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!