I’m trying to use the WWW class to load audio files from outside of the Unity Project while in the Unity Editor. To do this I end up making use of WWW.GetAudioClip.
Everything works great when the audio file is WAV. I get the following error when the audio file is MP3:
What’s confusing is that I’ve set the “stream” parameter to false in the call to GetAudioClip…
The goal is to be able to access the decoded samples of the audio file using the standard AudioClip.GetData API.
Anyone have any thoughts on workarounds or other approaches?
@janm_unity3d would this qualify as a bug? Is it known?
You can only do that on mobile platforms. If you set the build target to Android or iOS, it should work. It’s documented, but I’ve never seen a clear answer for why this is. I think it might be a licensing thing. MP3 technology is patented.
Ahh, thanks for the pointer about the build target. That’s really helpful.
Is it documented, though? If so, where? The WWW.GetAudioClip function doesn’t make any mention of platform-specific limitations…
Perhaps… but the Editor can decode MP3s regardless (import process), right? If it doesn’t work on PC/Mac/Linux builds then I presume they simply don’t include an MP3 decoder in the player as that might require a different license than whatever it is that they rely on for the editor itself.
This is a runtime API… I guess I wish that there was an Editor-only equivalent that worked regardless of the selected platform.