Hello everyone,
I tried to use the sample of code here to request an audio file in WebGL
build (in 2019.3.15f1).
But only Wav files work, and Mp3 or OGG fail to load.
I have read the limitation on my browser (Firefox) and normaly it support all this formats, but i alwais get
Streaming of ‘ogg’ on this platform is not supported.
Or mpeg.
How can I read compressed audio from SteamingAssets Folder ?
Thanks in advance.
Here the code i use:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class AudioRequest
{
public AudioClip audioClip = null;
public IEnumerator SendGetAudio(string url)
{
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.WAV))
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
throw new Exception(www.error + "
" + url);
}
else
{
audioClip = DownloadHandlerAudioClip.GetContent(www);
}
}
}
}