(WEB_GL) using WWW to download audio mp3 file,not finished download the whole file but isDone = true

Here is another problem aside from (WEB_GL) WWW.GetAudioClip not work with "ogg" both Firefox and Chrome - Unity Engine - Unity Discussions

As .ogg is not work on WEBGL, so I decide to use mp3 instead, and now there is no error about not support mp3 on this platform things… but!!!

The audio file that I got only play for the first 2 seconds. And the rest is gone, and the downloading time is pretty quick for a 3mbs mp3 file too. I try to check the www.progress but it’s appear that the www.progress value is 1 (100%) and also isDone is true…but actually it’s not true

I check the length and the samples and both are actually 0

Here is my code use to download mp3
private IEnumerator downloadMP3(string url, Action callback)
{
WWW www = new WWW(url);
yield return www;
if (www.isDone && string.IsNullOrEmpty(www.error))
{
AudioClip audioclip = [www.GetAudioClip(false,false](http://www.GetAudioClip(false,false), AudioType.MPEG);
Debug.Log("Progress : " + www.progress + “\n” + " Length(S) : " + audioclip.length + " Sample : " + audioclip.samples);
callback(audioclip);
}
else
{
Debug.Log(“An error occurred while downloading.”);
}
}

Is there any problem with the memory things? Or do I get things wrong? Now I’ve tried everything but it’s still doesn’t work. Somebody please help. :face_with_spiral_eyes:

I believe this is a known bug which we have fixed in Unity 5.3.

1 Like

Oh, right now I used Used Unity 5.2.1f1 I will try the Beta version.

And the other things is that the www download progress and isDone are correct because I just check the file size of the www.size and its match the original file. but when the www got converted by www.getAudioClip , it’s not get the correct audioClip (length = 0).

OMG!! It’s work in Unity 5.3 Beta 5 !! thank you so much.