[IOS] Wont Stream MP3 and won't dispose www. Freezes

Hey Guy’s,

I am working on a music player that streams mp3’s from a url. Everything works perfect in the Editor and on my Android devices, but when deployed to IOS I am having issues. My first issue is that IOS will not stream the MP3. It only works if I do a full download on the audio clip and then play it. My second issue is that I have a return button that simply loads a new scene when clicked. When clicking this button during the download/stream attempt of an mp3, IOS freezes instead of going to that scene. I have tracked the freezing issue down to this line of code:

audioSrc.clip = [www.GetAudioClip(false](http://www.GetAudioClip(false), true, AudioType.MPEG);

I have tried everything such as disposing the www,destroying the www,nulling www,and stopping all co-routines before trying to load the new scene and IOS still freezes. I am on Unity 5.3.0f4, so let me know if there has been a bug fix for this, but I couldn’t really find anything. Thanks! Here is what my stream code looks like:

IEnumerator PlaySong(Playlist SongInfo, int index)
{
www = new WWW(EncodeMediaURL(SongInfo.URLsrc));
while (www.progress < 0.10)
{
yield return new WaitForSeconds(0.1f);
}
if (www.error == null)
{
audioSrc = GetComponent();
audioSrc.clip = [www.GetAudioClip(false](http://www.GetAudioClip(false), true, AudioType.MPEG);

if (audioSrc.clip.length == 0)
{
yield return www;
audioSrc.clip = [www.GetAudioClip(false](http://www.GetAudioClip(false), false, AudioType.MPEG); //file cant stream so download it then play
}
StartCoroutine(StartAudio());
}
else
{
Toast.Message(“There was an error loading this song.”);
Debug.Log("Error loading mp3: " + www.error);:wink:
}

You have seen this? Maybe same problems?

Thanks for the reply. I actually somewhat resolved the dispose issue by upgrading to the latest version of Unity. It’s still not perfect, but does a 95% better job then previously. I am still having issues with IOS stream of the audio. My guess is that it has something to do with the mp3’s needing a constant bit rate? I believe I have read that somewhere on a thread. Thanks for your help!