Unity Android Voice Chat Issues (Playback Route, Bluetooth, Samsung Low Microphone Volume)

Unity Android Voice Chat Issues (Playback Route, Bluetooth, Samsung Low Microphone Volume)

Hi everyone,

I’m integrating LiveKit Unity SDK into a multiplayer game for Android, and I’ve run into several audio routing issues.

Environment

  • Unity (Android)

  • LiveKit Unity SDK

  • Real-time in-game voice chat (similar to Discord/game voice chat)

Issue 1: Audio plays through the earpiece instead of the media speaker

By default, voice playback is routed to the earpiece (phone call speaker) instead of the media/loud speaker.

For an in-game voice chat, users expect audio to come from the media speaker, not the call speaker.

To work around this, I’m currently calling native Android APIs to force audio output to the loud speaker.

Issue 2: Bluetooth headset no longer works

After forcing playback to the loud speaker, Bluetooth headsets are no longer used automatically.

Ideally, the routing behavior should be:

  • Bluetooth headset (if connected)

  • Wired headset (if connected)

  • Device loud speaker

  • Device earpiece only when explicitly desired

Is there an official or recommended way to configure LiveKit/Unity so Android handles these routes correctly?

Issue 3: Extremely low microphone volume on Samsung devices

This is the more serious issue.

On several Samsung devices, the remote participant hears my microphone at a very low volume.

The only workaround is for the listener to increase their media volume to nearly maximum.

Interestingly:

  • Playback volume on my own device seems normal.

  • The transmitted microphone level is what sounds extremely quiet.

  • This issue appears much more noticeable on Samsung devices than on other Android manufacturers.

Has anyone experienced this before?

Could this be related to:

  • AudioManager configuration?

  • Audio mode (MODE_NORMAL vs MODE_IN_COMMUNICATION)?

  • Audio source selection (VOICE_COMMUNICATION, MIC, etc.)?

  • Android audio processing (AEC/AGC/NS)?

  • Something specific in the LiveKit Unity SDK?

If anyone has recommendations for the proper Android audio configuration for game voice chat using LiveKit, I’d really appreciate it.

Thanks!

Hi Alireza,

Thanks for your interest in the SDK. I have a few questions about your setup:

a) Are you using or have you tried the Meet sample at https://github.com/livekit/client-sdk-unity/tree/main/Samples\~/Meet ?

b) I assume you are using the Platform audio path but can you please confirm?

Now to your problems:

For Platform audio, I sometimes noticed the same behaviour you see in #1. and #2. I have a fix probably similar to yours calling into Android APIs, but mine is reordering the priorities to Bluetooth > Speaker > Earpice. So it should solve your issues #1 and #2 at the same time. Have a look at the Android specific code here:

For your issue #3 I can not really say anything myself as I don’t have a Samsung phone on me. But to narrow down the issue, you could compare against using the Unity audio route and also compare against using the standard Meet sample.

Please let me know if this helped.

Max

Thanks for the update. I tested the latest changes using the Meet Sample and wanted to share my feedback.

For this test, I added PlatformAudioController.cs exactly as provided in the GitHub repository and updated MeetManager.cs to match the latest GitHub version. Here are the results:

  • Headset routing: Audio is now routed correctly to a wired headset or Bluetooth headset if it is already connected before joining the room. However, if I connect or switch to a headset after joining, the playback audio does not switch to the headset.

  • Fallback after disconnecting a headset: If I join the room with a headset connected, playback works correctly through the headset. However, after disconnecting it, the playback falls back to the earpiece speaker instead of the device’s media/loud speaker.

  • Samsung microphone issue: The low microphone volume issue still exists. I’m not yet certain whether this is specific to Samsung devices, but so far I’ve tested on 4 Samsung devices, and all of them had the same very low microphone volume problem. I also tested on 2 non-Samsung devices, and they did not have this issue. I tested both the Unity Audio implementation and the Meet Sample (PlatformAudio), and both exhibited the same barely audible microphone volume on the affected Samsung devices.

  • Additional observation: On the affected Samsung devices, if I use a wired or Bluetooth headset for the call, the low microphone volume issue disappears. The problem only occurs when using the phone’s built-in microphone.

Please let me know if there is any additional logging or information I can provide to help investigate these remaining issues.

@Alireza_Karimy, Max’s PR #364 handles #1 and #2, so the open one is #3. Quick map:

  • #1/#2: Platform Audio routes playback through the native WebRTC ADM, which defaults to the earpiece on Android. PR #364 reorders it to Bluetooth > Speaker > Earpiece. Pull that in and both should resolve.

  • #3 cause: Platform Audio applies auto gain control and hardware processing on the mic capture, the README lists it as unlocking “echo cancellation, noise suppression, auto gain control.” That AGC is the mic-level knob, and on some Samsung units it clamps the captured level hard, which fits your symptom exactly: quiet transmitted audio while your own playback is fine.

  • No SDK knob today: the audio session is hardcoded (the iOS side is tracked in #330); there is no exposed Android audio-mode or source setting.

The quick diagnostic and workaround is to publish the mic through the Unity Audio path instead, which does not run that native AGC/processing:

var micObject = new GameObject("my-audio-source");
var rtcSource = new MicrophoneSource(Microphone.devices[0], micObject);
var track = LocalAudioTrack.CreateAudioTrack("mic", rtcSource, room);
var options = new TrackPublishOptions { Source = TrackSource.SourceMicrophone };
yield return room.LocalParticipant.PublishTrack(track, options);
rtcSource.Start();

If the Samsung level jumps back, the native AGC was it. Realistic trade-off: Unity Audio drops the hardware echo cancellation Platform Audio gave you, so on an open loudspeaker you may need software AEC or push-to-talk. If you want to stay on Platform Audio and still fix the gain, a focused issue with the exact Samsung models is the route.

Thanks for the suggestions.

Regarding #1 and #2, I’ve already posted my test results after trying Max’s PR, so I’m waiting for Max’s response.

Regarding your suggestion for diagnosing #3, I actually started with the Unity Audio path before Platform Audio was introduced. I implemented microphone publishing using MicrophoneSource, as you suggested, and the low microphone volume issue was still present on the affected Samsung devices. So unfortunately, the problem doesn’t seem to be specific to Platform Audio or its AGC.

At this point, it seems more likely that the issue is either device-specific or somewhere deeper in the Android/Unity/WebRTC audio stack.