Thanks for the video demonstrating the issue, and for testing the repro for it so thoroughly yourself!
I’ve done a bit of a deep dive into it, and the issue is due to other applications using a larger buffer size for audio than FMOD. FMOD uses what is half the usual buffer on iOS to provide audio with lower latency (512 samples in FMOD for Unity settings → Platform Specific → DSP Buffer Settings → DSP Buffer Length). When FMOD audio is suspended in favor of other applications, the buffer than iOS provides the active audio session increases to match the other app’s audio, and usually when the Unity FMOD app resumes, the buffer is reduced to match what FMOD is outputting.
What appears to be happening with Brave is that, due to Brave playing backgrounded audio, the buffer iOS provides to be filled by FMOD stays at twice what FMOD is outputting. As a result, FMOD can’t resume properly, Studio processing isn’t performed, and callbacks aren’t fired.
The simplest approach to addressing this is to increase FMOD’s DSP Buffer Size from 512 to 1024, which will cause FMOD to resume correctly which Brave is playing backgrounded audio, and process callbacks even if it’s not outputting audio. Note that this will increase FMOD’s latency, which may or may not be an issue for you.
If latency would be an issue, you can force other applications’ audio to stop when your app comes to the foreground and hopefully avoid the issue with Brave playing backgrounded audio. This can be done by modifying ./Assets/Plugins/FMOD/platform_ios.mm
and adding the following line at the start of RegisterSuspendCallback
:
extern "C" void RegisterSuspendCallback(void (*callback)(bool))
{
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:nil]; // New line here
// ...
}
This should cause your app to stop all other applications from outputting audio at the same time. However, exactly what other apps try to do with audio can’t be guaranteed, so you may run into situations where this doesn’t work.
Give those solutions a try and let me know how they go.