forked from pixiv/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 1
Platform Specifics: Audio
sebjf edited this page May 7, 2021
·
2 revisions
Whether a specific or the default device is used is determined by the audio_device_core_win.cc
_usingOutputDeviceIndex
flag. If set, the indexed device from IMMDeviceEnumerator::EnumAudioEndpoints
is chosen, otherwise the default device is chosen with IMMDeviceEnumerator::GetDefaultAudioEndpoint.
The flag is set after a call to SetPlayoutDevice()
/SetRecordingDevice()
.
Android only allows changing the Audio Device via the Android API. Most ADM APIs work, but the GetPlayoutDeviceName()/GetRecordingDeviceName() methods issue a Fatal log message, so should not be called.
The application should switch the audio mode to Communication on Android, like so:
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject audioManager = activity.Call<AndroidJavaObject>("getSystemService", "audio");
audioManager.Call("setMode", 3); // 3 is Communication Mode