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

Hi,

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

Here is the code.

 using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url,AudioType.OGGVORBIS))
        {
            yield return www.Send();
            if (www.isNetworkError)
            {
                Debug.Log(www.error);
                errorText.enabled = true;
                errorText.text = "Please press restart download button due to error " + www.error;
                restartBtn.gameObject.SetActive (true);
                throw new Exception ("WWW download had an error " + www.error);
            }
            else
            {
                AudioClip myClip = DownloadHandlerAudioClip.GetContent(www);
               
            }
        }

I’ve tried other solution like normal UnityWebRequest and WWW, but the problem still persist.
Please help, thank you

fix by using .wav audio

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

AudioType.AUDIOQUEUE

instead of

AudioType.OGGVORBIS

… and it just works.

If someone can explain why it works, i’m curious to know.

1 Like

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 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. )

1 Like