Any known solution for quick muting/pausing webgl audio when tab switching?

I’m trying to find a good solution to not have a bad user experience when switching tabs. I know the limitations as said in here: Audio stutters when switching tabs in browser but I would like to know what possible solutions I can apply.

Right know I managed to detect the switch of tabs/minimize and then mute the audio but the downside its that its not applied fast (It takes around 1-2s for the audio to mute) and stuttering is heard. Is this the best solution available right now or there is another one that I don’t know of?

Hi - apologies for the delayed response,

I’m able to get WebGL audio to pause immediately on switching tabs using the following MonoBehaviour code, which is based on what RuntimeManager already does for OnApplicationPause:

    private void OnApplicationFocus(bool focus)
    {
        if (RuntimeManager.StudioSystem.isValid())
        {
            RuntimeManager.PauseAllEvents(!focus);

            if (!focus)
            {
                RuntimeManager.CoreSystem.mixerSuspend();
            }
            else
            {
                RuntimeManager.CoreSystem.mixerResume();
            }
        }
    }

Give it a try, and let me know if there’s any issues.