Is there a working example of mp3 streaming using UnityWebRequest/DownloadHandlerAudioClip in WebGL ?
I tested it settings DownloadHandlerAudioClip.streamAudio = true, but no matter what I do, when I test it with a rather large MP3 file, I can see in the browser console that Unity only starts playing the sound AFTER the whole stream has been received, as opposed to starting whenever an initial buffer is received.
My code looks like this:
using (var req = new UnityWebRequest(url, "GET", new DownloadHandlerAudioClip(url, AudioType.MPEG)))
{
DownloadHandlerAudioClip dlHandler = (DownloadHandlerAudioClip)req.downloadHandler;
dlHandler.streamAudio = true;
var download = req.SendWebRequest();
yield return download;
AudioClip audioClip = dlHandler.audioClip;
audioClip.Play();
}