WWW.audioClip not playing on android build

I’m referencing the Unity C# documentation here.

When using WWW.audioClip in the editor (Unity 5.4), it works fine (build is set to android). However, once I build and run the APK on an actual device, there is no sound. Other sounds work, but anything using WWW.audioClip won’t work. I’m using mp3 files that I uploaded to a server to avoid using memory.

Sample url → 159.203.212.244/music/kpop/haruHaru1.mp3

Code snippet:

void Start(){
        // No changes made from unity docs here
        // allClips is an array of strings (urls in the same form as above)
		WWW www = new WWW (musicURLs.allClips[songCounter] );
		source = GetComponent<AudioSource> ();
		source.clip = www.audioClip;
	}

// this is attached to a button, so that when you click it the clip will play
public void playMusicStream(){
		// now play
		if (!source.isPlaying && source.clip.isReadyToPlay)
			source.Play ();
	};

I have a domain name tied to the server address, so switching to http://preciousperfect.com/music/kpop/haruHaru1.mp3 would map to the same place (haven’t tried this).

Thoughts:

  1. The app already gets access to network privileges, so I don’t think it’s a problem with being allowed to access an external link.
  2. I don’t think it’s an internal issue. I think I’m missing something and I’m doing this incorrectly, but I couldn’t find anything about this online.

Any solutions/guidance will be greatly appreciated!

Have you tried yield turn www?

For example"

void Start() {
  StartCoroutine(getAudio());
}
IEnumerator getAudio() {
    WWW www = new WWW (musicURLs.allClips[songCounter] );
    yield turn www; // it will wait for downloading music finished
    source = GetComponent<AudioSource> ();
    source.clip = www.audioClip;
}