Search code examples
c#unity-game-engineagora.io

Joining a channel on Agora (Unity/iOS) makes in-game music almost inaudible


I'm trying to integrate Agora voice SDK in a multiplayer project (built using Photon). The level has loads of 3D spacial audio setup and a background music that is properly audible. The moment I join a voice channel, all the in-game audio levels drop drastically. The voice chat volume itself sounds fine however. And this happens only on actual device(iOS), not on Unity editor.

I tried reproducing this issue in the HelloUnity3D sample scene that comes with the SDK. No code change. Simply added an audio source in the scene with a music clip. Seems to be happening there as well.

Is this expected? How do I keep Agora from modifying other audio sources?

Unity version:2020.3.28f1. Agora SDK version: 3.5.0.70


Solution

  • For anyone running into this issue, I was able to fix it by setting the audio profile to AUDIO_SCENARIO_GAME_STREAMING.

    mRtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_SPEECH_STANDARD, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_GAME_STREAMING);
    

    The idea is to simply treat the voice chat audio as media volume instead of 'call' volume.