Zoom Video Android SDK audio output to earpiece

Description

Whenever the user joins a session, they always use the speaker instead of earpiece.
I am wondering if there a way to config the audio settings to let it use the earpiece instead?
I checked the SDK reference and can’t find any.

Which Android Video SDK version?
1.13.11

To Reproduce(If applicable)
Pick up a VOIP call, and verify the user is using speaker

Smartphone (please complete the following information):

  • Device: [e.g. Samsung S21]
  • OS: [e.g. Android 14]

Hi @fteng You can try the setSpeaker method in the AudioHelper class, set to false.

Hi Ticorrian

Thanks for your reply. Apologies for the lack of clarity in my previous message.

We’re successfully using setSpeaker for user actions during a call. The issue is that we can’t configure the speaker mode when initializing the call. For example, this code doesn’t work as expected:

audioHelper.startAudio();
audioHelper.setSpeaker(false);

Our current workaround is set the speaker mode with a delay which is not ideal

   audioHelper.startAudio();
    new Handler(Looper.getMainLooper()).postDelayed(() -> {
      audioHelper.setSpeaker(false);
      audioHelper.setSpeaker(true);
      audioHelper.setSpeaker(false);
    }, 1000);

Is there a way to configure the audio so it can start with the speaker off?
Thanks in advance.

Kind regards
Fei Teng

Hi @fteng, from my testing, I am able to call this function from my onUserAudioStatusChanged event callback function when the user joins the meeting. In the function, if the user is the current user, I call another function that executes this code:

fun testLogic(): Unit {
        val user: ZoomVideoSDKUser = ZoomVideoSDK.getInstance().session.mySelf
        val audioHelper: ZoomVideoSDKAudioHelper = ZoomVideoSDK.getInstance().audioHelper
        val audioType: ZoomVideoSDKAudioStatus.ZoomVideoSDKAudioType? = user.audioStatus?.audioType

        audioHelper.startAudio()
        audioHelper.setSpeaker(false);
        _zoomSessionUIState.update { it.copy( audioConnected = true, muted = true )}
    }

Then I run ZoomVideoSDK.getInstance().audioHelper.speakerStatus to check that the status is updated.

Is your join flow similar to this?

1 Like

Thanks Ticorrian
This flow works for us! I think this is due to a race condition in our codebase.