Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Errors loading audio using WebGL

Discussion in 'Addressables' started by inkletom, Aug 1, 2020.

  1. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
    It seems audio doesn't play on WebGL when loaded from an externally hosted assetbundle.
    "Error: Cannot create FMOD::Sound instance for clip "audioName" (FMOD error: Unsupported file or audio format. )"


    There are some old forum posts with this issue from pre-addressable, but none contain solutions that work today.

    Is this a known bug?
     
  2. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
    Update - this is true both in Editor on 2020.1, and in both Editor and WebGL builds on 2020.2.0a
    Notably, the load state of the clip after loading it via addressables is AudioDataLoadState.Unloaded, and trying to fix that with audioPlayer.clip.LoadAudioData causes the same error.
     
  3. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
  4. dominator909

    dominator909

    Joined:
    Oct 8, 2020
    Posts:
    8
    Using this same set up I encountered this issue. Loading an Addressable AudioClip through a RemoteLoadPath on WebGL throws this FMOD error.

    Did you manage to solve this issue?
     
  5. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
    I think we did, although I can't recall what we did. Here's our code -
    upload_2020-11-16_19-25-0.png
     
    dominator909 likes this.
  6. dominator909

    dominator909

    Joined:
    Oct 8, 2020
    Posts:
    8
    I used this bit of code, and the code I was origially using, but am still running into issues with it being unable to load any AudioClips.

    I have moved past the "Unsupported file or Audio format" error by adjusting some of the import setting so I think I'm going in the right direction.

    I see that you posted on another forum which you seem to have encountered this next error. Do you remember how you solved the following error?

    Failed getting load state of FSB
     
  7. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
    I don't, sorry! It was a while back, I think we just messed with settings until it stuck :/
     
    dominator909 likes this.
  8. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
  9. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
    I'll ping the team, see if they have any insight or guidance they can pass along.
     
  10. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hmm would you mind submitting a bug report with a repro project? I'd be interested in seeing the call stack.
     
  11. unity_waiIJd6fbNxk4Q

    unity_waiIJd6fbNxk4Q

    Joined:
    Jul 12, 2019
    Posts:
    1
    Code (CSharp):
    1.     IEnumerator GetAudioClip()
    2.     {
    3.         using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("https://www.the3rdsequence.com/soundb/data/sounds/55/55.ogg", AudioType.OGGVORBIS))
    4.         {
    5.             yield return www.SendWebRequest();
    6.  
    7.             if (www.isNetworkError)
    8.             {
    9.                 Debug.Log(www.error);
    10.             }
    11.             else
    12.             {
    13.                 myClip = DownloadHandlerAudioClip.GetContent(www);
    14.                 audioSource.clip = myClip;
    15.                 audioSource.Play();
    16.                 Debug.Log("Audio is Playing");
    17.             }
    18.         }
    19.     }
    20.  
    Hi, I am getting the same error in Webgl build, but I am not using asset bundle, I am just accessing a link that contains a sound file. The error is the same -
    "Error: Cannot create FMOD::Sound instance for clip "audioName" (FMOD error: Unsupported file or audio format. )". Is this a bug in Unity or am I doing something wrong?
     
  12. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    @unity_waiIJd6fbNxk4Q I believe .ogg isn't supported for WebGL builds because the format is not universally supported across browsers. Can you try loading the files as .mp3?
     
  13. Reshad

    Reshad

    Joined:
    Mar 23, 2013
    Posts:
    6
    Then what will be the AudioType?
     
  14. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi @Reshad I just double checked with the WebGL team, and the WebGL platform utilizes the built-in audio support codecs available in web browsers. The different types of audio that are supported can be found here
    https://caniuse.com/?search=audio format

    @inkletom I was able to reproduce the "FMOD error: Unsupported file or audio format." errors when loading audio files from WebGL AssetBundles in the Editor. But in the Player, the audio files load perfectly fine. I've created a ticket to investigate the issue.

    Here's the versions I used:
    Addressables 1.18.16, 1.19.6
    Unity 2020.3.15f2

    I couldn't reproduce the "Failed getting load state of FSB" error, but I suspect whatever is causing the different behavior in the Editor vs the Player is related.
     
  15. ShadowHealth

    ShadowHealth

    Joined:
    Apr 2, 2015
    Posts:
    6
    We are now seeing "Loading FSB failed for audio clip ____ " in Safari 15. This appears to be limited to Safari 15 on macOS 10.15.x, but is encountered for Unity versions from 2020.3 back to 2018.x. And for audio clips which are in the build & those loaded from www/xhr at runtime. All of our audio files are mp3

    Browser console errors:
    https://imgur.com/a/2TdomIU
     
    Last edited: Oct 8, 2021
  16. ShadowHealth

    ShadowHealth

    Joined:
    Apr 2, 2015
    Posts:
    6
    For others, we've reported here and it appears likely to be an issue w/ MP3 decoding in Safari 15 on macOS 10.15 https://bugs.webkit.org/show_bug.cgi?id=231449
    Probably a separate issue than the one originally reported in this thread, apologies
     
  17. jinjerie

    jinjerie

    Joined:
    Aug 24, 2022
    Posts:
    1
    @pillakirsten Hello! I'm seeing this exact issue and could not find the ticket you were referring to in the Issue Tracker (if that is the right place to look). Could you please let me know if this was resolved?
     
    Last edited: Oct 18, 2022
  18. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    @jinjerie Hmm it's an internal ticket that's been closed as not reproducible "Unable to repro with latest addressables, even in the case the user mentioned on mac with Safari. Was able to see AAC audio files indeed cannot be loaded directly".

    If you're still able to reproduce the issue on a newer version, please send us a bug report