- Home /
why mp3 can't work on web/standalone?
I found a very strange thing. That is you can't use www.audio to get a mp3 file as audioclip on Web/Standalone builds:
From file:///W:/Work%20Software/Unity/Editor/Data/Documentation/Documentation/ScriptReference/WWW.GetAudioClip.html
The data must be an audio clip in Ogg(Web/Standalones), MP3(phones), WAV, XM, IT, MOD or S3M format.
Is there a workaround for this?
Answer by Julien-Lynge · Sep 20, 2011 at 09:32 PM
Unity has chosen to only support open source standards for web/standalones at runtime, so for reading directly you're out of luck.
Here's a couple ideas for workarounds to get you started:
* Come up with an external process that converts mp3 to ogg audio, and then pass to unity
* Make your WWW call as usual and then get the www.bytes, then use a library to convert to ogg and feed back into Unity as an audio clip
Note that these are only for WWW calls. If you have the file locally when you're compiling Unity and you include it as an asset it will automatically be converted to ogg.