Free Code: Load, persist, play audio from the cloud

Hi,

Audio embedded in iPhone games fattens the install, and the WWW audioClip property doesn’t work due to the ogg-vorbis thing (in fact, even in Unity3 beta5, where the embedded FMOD lib is capable of being built with an ogg codec, it still doesn’t work).

So I wrote a tutorial and provided some source to illustrate how to load audio from the cloud (I use Amazon Cloudfront, personally) into a Unity iPhone game, store it locally so that it subsequently gets loaded from the local device, and play it back using a native audio player that is controlled by Unity script.

I did this as part of a freelance job for a client (which is why it’s better documented than what I would have done for my own projects!) but I did clean it up a bit for general usage. It works in the editor and standalone as well, although I find it most useful for iPhone targets.

If it’s helpful to you, feel free to use it however you like, commercial or otherwise. If it breaks something, I apologize – and please yell at me so I can fix it.

It’s attached to this post, but I believe you need to be logged into the forum to see the attachment. After you extract the archive, open the docs/index.html file in a browser to view the details.

Cheers,
Sean

366409–12719–$musicloader_unity_209.zip (229 KB)

Very Cool. Thank you for sharing your experience. I have need of just such a thing in the next couple of weeks.

Thanks for that. It may come in handy for a project in the works. Gracias!