[iOS] iTunes audio muted when Unity game is active


We recently release a game on iOS made with Unity (5.5.4) and went with FMOD (1.09.06) for the audio engine and we are now facing the follow problem :

If a user is listening to music and then starts our game, once FMOD is initialized it will immediately cut the music on the player device, and will only allow audio from the game.
Even if you go back to iTunes and play the music again, it will be cut if you go back to the game.

It’s a very poor experience for people who prefer to listen to their music while playing, but we cannot find the exact root cause. We know it’s FMOD, because we don’t reproduce it when building an empty Unity project. But if we add FMOD to that empty project, then we reproduce it at 100%. The problem occurs on iOS 9, 10 and 11 from our tests.

Anybody would have an idea on how to resolve it ? Guess it could be related to the audio session category behavior on Apple devices, but if it is it’s managed in FMOD iOS compiled libs

FMOD doesn’t do anything with the AudioSession, normally it is left up to the developer. In this case Unity would normally take care of this for you, but it looks like by disabling Unity’s inbuilt audio it also disables setting the AudioSession Category.
This means it will be using the default (AVAudioSessionCategorySoloAmbient) which will silence background audio.

At the moment we don’t expose a way, through FMOD, to set/change the AudioSession Category.

The Apple Audio Session Programming Guide has this information and more.

Thank you! Setting the AudioSession’s category to AVAudioSessionCategoryPlayback with the option AVAudioSessionCategoryOptionMixWithOthers resolved the problem!