FMOD music will not resume after Ironsource Ads

So I’ve done a little more investigation into the issue - it seems that my statement that:

is incorrect. What actually happens is when Ironsource plays an ad (i.e. a rewarded video) the FMOD system continues to run in the background and attempt to output audio. In theory, both FMOD and Ironsource will both output audio simultaneously, no problem.

However, the issue is that Ironsource does something to the AudioSession that changes the length of its audio buffer. For example, by default FMOD’s buffer is ~16KB (512 byte buffer * 4 buffer blocks * 32 bit float) long, but on playing a rewarded video, the buffer the AudioSession requests changes length (e.g. to 23040 bytes). This immediately triggers an error, as the FMOD system’s buffer length is insufficient, and causes FMOD not to output audio. Ironsource doesn’t appear to reset the buffer length either, meaning that FMOD continues to receive the error and not output audio, even after the ad is finished.

If Ironsource did reset the AudioSession’s buffer length to what it was before the rewarded video, then suspending FMOD before starting an ad and the resuming in the relevant callback or in OnApplicationPause(false) should work.

As a workaround, increasing FMOD’s buffer length to be larger than what Ironsource uses will ensure that audio is outputted correctly. You can do this in Unity at FMOD → Edit Settings → Platform Specific → DSP buffer length - doubling it to 1024 (effectively 32KB) worked for me. However, I have noticed that the buffer length Ironsource uses can vary, so there may be situations where the buffer length it uses exceeds FMOD even at 1024.

1 Like