When using Unity objects like AudioSource and AudioClip to play the music on an iOS device, you may encounter the following issue:
When you use Unity objects to play the music before joining a channel, the status of the system AudioSession
is set to active. After you join or leave a channel, the Agora Unity SDK changes the status of the system AudioSession
to inactive, which is why you cannot hear the music after joining or leaving a channel.
Before joining a channel, call mRtcEngine.SetParameters("{\"che.audio.keep.audiosession\":true}");
to keep the status of the system AudioSession
as active. This ensures that you can hear the music, even after you join or leave a channel.