[Bug][2.02.04] WebGL - Safari - No Audio in FMOD, but works for other browsers

Hi There,

Test WebGL: urp-test

In Chrome/Firefox clicking ‘Init’ followed by ‘Play Sound’ emits audio as expected, however no audio is heard on Safari :frowning:

As per the docs the INIT FMOD button runs
https://fmod.com/resources/documentation-unity?version=2.01&page=platform-specifics.html

    FMODUnity.RuntimeManager.CoreSystem.mixerSuspend();
    FMODUnity.RuntimeManager.CoreSystem.mixerResume();

And the play sound button is a simple FMOD Studio Event Emitter

Are there any known Safari specific issues?

Versions:
Unity 2020.3.25f1
FMOD 2.02.04
Safari 15.4
MacOS 12.3

Thanks,

Matt

Note this also still appears to be an issue with the HTML5 FMOD sample demo [Bug] WebGL - Safari - No Audio in FMOD Docs Example

I have verified 2.02.04 is working fine in Safari. It looks like you are meeting the user interaction requirement correctly, the other one for WebGL is async bank loading, are you loading your banks asynchronously?

Hi @jeff_fmod yep I can confirm that the banks are loaded, and indeed it is still broken in Safari (just to reiterate as well, works fine in Chrome). Possibly it is related to the Safari version? However I’ve made a minimal reproduction project which can be downloaded from:

  • Note the project is quite large due to the FMOD Plugin being included ~300mb download

I’ve also rebuilt this project to a new URL
https://storage.googleapis.com/yutani-world/builds/dev/FMOD_BUG_SAFARI/index.html

And a gif because everyone loves soundless gifs on an FMOD forum :smiley: :
fmod_bug

Please let me know if I can assist with any other repro steps!

Just tested on Safari 15.2, MacOS 12.1 and no audio, so I don’t think it is version specific

Thank you for sending that over, I can see that banks are not being loaded asynchronously. We have an Async Loading Script Example which demonstrates how to achieve this. To use it you need to setup a separate load scene that will load your game’s banks and main scene, in your case “SampleScene”, asynchronously.
Screen Shot 2022-04-07 at 12.39.00 pm
By adding in this load scene to your repro I have found that audio works correctly in Safari- though I found I also had to add calls to mixerSuspend and mixerResume after calling the coroutine, e.g:

    public void Start()
    {
        StartCoroutine(LoadGameAsync());
        FMODUnity.RuntimeManager.CoreSystem.mixerSuspend();
        FMODUnity.RuntimeManager.CoreSystem.mixerResume();
    }

Please have a go implementing this, I will make a task to update the docs to make it clear how to load banks in a load scene for WebGL.

Firstly, thanks for continuing to look at this, and thanks for the suggestion,

Unfortunately this didn’t work -

I implemented it as described, where there’s an initial loading scene, runs the script as-is copied from the documentation URL, setup the bank references identically to your screen shot, and also re-call the mixer suspend resume code. But unfortunately no difference when building and comparing safari to chrome.

So firstly -

I found I also had to add calls to mixerSuspend and mixerResume after calling the coroutine

This doesn’t tally with the documentation - as the browsers require a user interaction in order for them to allow audio. With this change I still have to click my “Initialise Audio” button before “Play Sound”.

I’ve updated the project and re-uploaded with your suggested changes at

However potentially more helpful I have a side-by-side video (with audio! :D) of the build running in safari and chrome to make it really clear what I’m seeing:

Lastly if the asynchronous bank loading was important, then my call to FMODUnity.RuntimeManager.HaveAllBanksLoaded in the original code should return false, but it was returning true (as showed in the gif). So I find it hard to understand why the bank loading would have been an issue in the previous version.

Anyway hope there’s enough there to help you continue to investigate.

Thanks!

Matt

Strangely it’s working for me- one thing to try, can you please try going into your Safari browser and changing your video auto-play preferences to Allow All Auto-Play?

1 Like

Okay good news and bad news :slight_smile:

So the good news is, setting ‘Allow All Auto-Play’ does mean the FMOD project works! The bad news is I don’t think this is a long term workaround.

  1. Unity built-in audio works without needing to set allow auto-play, I’ve made a fresh unity project, single sound source and button to play. If it is supported with unity built-in, then it should be possible with FMOD? Built-in audio example here:
    Unity WebGL Player | unity_builtinaudio_fmodbug

  2. Autoplay being disabled is the default safari setting, which would mean in order for players to have sound in the game, they would need to follow manual instructions to allow audio autoplay.

Because of both of these, but primarily the fact that it works fine with built in unity audio, is it something you might be able to look at?

And just to say again, really do appreciate that you’re helping diagnose this!

And just for completeness :smiley: The hosted FMOD and Built-In projects

FMOD HTML5
Unity Built-in HTML5

And a video comparing these websiutes in Safari with audio initially on auto-play off, and then with auto-play on.

Than you for verifying, I agree it is unreasonable to expect users to change their browser settings- especially considering Unity doesn’t have this issue. The Dev team has been updated with this information and will continue investigating the issue, please use the autoplay workaround in the meantime and let us know if you run into any other issues.

1 Like

Thanks Jeff much appreciated.

Is there a public bug tracker of any sort for FMOD?

We recommend keeping an eye on our release notes which will be emailed to you when we release an update, and you can subscribe/unsubscribe to them in your Profile.
Other than that, our Revision History page has a list of all the changes for each release.