AVAudioSession Deactivated when I leave Channel Agora Voice Unity SDK

115 Views Asked by At

I am using Agora Voice Unity SDK for voice calling in my App. I facing a problem that when I leave channel on iPhone . My button clicks sounds stops working.

by investigating I found "AVAudioSession" is deactivating on leaving channel.

Here is the Console Log Statement:

"2023-08-04 01:03:29.359231-0700 AgoraVoicetest[1362:131944] [avas] AVAudioSession_iOS.mm:1271 Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session."

This log appears when I leave channel.

Here is my code screenshot for leave channel.

Leave Channel Function SS (C# , Unity)

I have tried "DisableAudio()" function upon leaving channel. Expected result: Upon leaving channel , only voice communication should be disabled/disconnect . Game media sounds (e.g: Button click sounds) should remain active.

1

There are 1 best solutions below

0
On

For others running into this issue on iOS, Agora's support team helped me with putting the following code before joining a channel:

_myRtcEngine.SetParameters("{\"che.audio.keep.audiosession\":true}");

The long and short of it is that iOS audio sessions are shared and Agora needs to make sure to return/restore that AVAudioSession