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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Audio Streaming of 'ogg' on this platform is not supported for WebGL build

Discussion in 'Audio & Video' started by 4zan, Jul 24, 2017.

  1. 4zan

    4zan

    Joined:
    Aug 27, 2015
    Posts:
    3
    Hi,

    I'm trying to download an .ogg file using UnityWebRequestMultimedia but received the above mentioned error for WebGL build.
    Here is the code.

    Code (CSharp):
    1.  using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url,AudioType.OGGVORBIS))
    2.         {
    3.             yield return www.Send();
    4.             if (www.isNetworkError)
    5.             {
    6.                 Debug.Log(www.error);
    7.                 errorText.enabled = true;
    8.                 errorText.text = "Please press restart download button due to error " + www.error;
    9.                 restartBtn.gameObject.SetActive (true);
    10.                 throw new Exception ("WWW download had an error " + www.error);
    11.             }
    12.             else
    13.             {
    14.                 AudioClip myClip = DownloadHandlerAudioClip.GetContent(www);
    15.                
    16.             }
    17.         }
    I've tried other solution like normal UnityWebRequest and WWW, but the problem still persist.
    Please help, thank you
     
  2. 4zan

    4zan

    Joined:
    Aug 27, 2015
    Posts:
    3
    fix by using .wav audio
     
  3. Drakulo

    Drakulo

    Joined:
    Oct 31, 2012
    Posts:
    6
    Hi there.

    I stumbled on this specific issue and this thread comes up when searching for that problem. There is a weird solution for that (working on Unity 2019.2.21f1). Use the type

    Code (CSharp):
    1. AudioType.AUDIOQUEUE
    instead of

    Code (CSharp):
    1. AudioType.OGGVORBIS
    ... and it just works.

    If someone can explain why it works, i'm curious to know.
     
    joshuam_86 likes this.
  4. joshuam_86

    joshuam_86

    Joined:
    Oct 22, 2020
    Posts:
    1
    I was encountering this issue as well. Our game was previously built using 2019.4.18f1 and we had no issue of downloading .ogg audio files. I just encountered the same issue when we upgraded to 2020.3.15f2 and built our game. After successfully downloading the audio, the error would pop out. This only occurs for downloaded .ogg audios and not with .ogg audios that was imported and built in the project.

    I tried your solution using
    Code (CSharp):
    1. AudioType.AUDIOQUEUE
    and it worked. I guess AUDIOQUEUE supports AAC which widely browser supported as per Unity's documentation. But that's just a guess.
    Though if I were to test it on the editor (Windows Standalone or WebGL platform), it would throw an error:
    Error: Cannot create FMOD::Sound instance for clip "" (FMOD error: Unsupported file or audio format. )
     
    Drakulo likes this.