Audio stutters when switching tabs in browser

Hi, I’m currently developing a HTML 5 game using FMOD and Unity.
Build works ok, but switching tabs inside the browser causes the audio to lag/stutter real bad. Minimizing the browser window also causes the same issue.

Switching windows between the browser and other applications works fine so I’d guess it’s something related to the browser saving resources when switching tabs/minimizing.

Is there a solution for this? I thought about pausing the game automatically when losing focus, but I’d rather just fix the stutter instead of working around it.

(Using FMOD Studio 2.00.06 and Unity 2018.4.6f1. Tested in Opera and Firefox.)

https://docs.unity3d.com/Manual/webgl-performance.html

If Run in background is enabled in the Player settings for the WebGL platform, or if you enable Application.runInBackground, your content continues to run when the canvas or the browser window loses focus.

However, some browsers can throttle content running in background tabs. If the tab with your content is not visible, your content only updates once per second in most browsers. Note that this causes Time.time to progress slower than usual with the default settings, as the default value of Time.maximumDeltaTime is lower than one second.

MonoBehavior.Update currently drives the FMOD System update through the RuntimeManager, which is expected to be called around every 20ms, and once every second isn’t enough for FMOD to run properly. Pausing the game would be best in this case.