- Home /
WWW.audioClip error: Unable to determine the audio type from the URL
I am attempting to play an audio clip retrieved from the web, using the WWW class.
WWW www = new WWW(url);
AudioClip clip = www.audioClip;
The problem is that www.audioClip is null, and I get the following error message to console:
Unable to determine the audio type from the URL (my url to my sample) . Please specify the type.
UnityEngine.WWW:get_audioClip()
If I visit the supplied URL I can download the sample, that is an MP3 file. I think the problem is this: the URL provided to WWW does not end with the name of the file plus the extension! So my question is: if the problem is what I think, how can I specify the type of audio file so that the WWW class knows it's going to download an MP3 file?
Answer by K1kk0z90_Unity · Sep 20, 2015 at 07:46 AM
Silly me, it was so easy but I didn't figure it out. :) In this case I can use the WWW.GetAudioClip() method instead of directly getting the audioClip property. The third parameter of the said method is an enum corresponding to the audio type.