I'm working on a little web app that uses Firefox 4's Audio Data API to manipulate raw audio samples. I'd like the user to be able to supply their own source material, but unfortunately Firefox 4 doesn't currently support mp3s in Audio elements. I've been looking for a way to easily transcode mp3 files into ogg files to get around this restriction, and I thought I had found my answer in Firefogg, a Firefox extension that makes client-side transcoding relatively simple. Firefogg even provides a preview URL for the transcoded ogg file (beginning with "firefogg://") that can be used as the source in the Audio tag.
This all seemed perfect... until I tried to access the raw audio samples via the Audio Data API, at which point Javascript threw a security exception. I'm assuming this has something to do with the source audio being in the local filesystem rather than the server... though I tried disabling some of the "same origin" security policies, and I still ran into this error. The strangest thing is that the audio itself plays fine as a normal Audio element... Firefox just won't allow me to touch the underlying sample data.
Now, before someone suggests this... yes, I could just give up and tell the user "this app only accepts ogg files." I could also try uploading the ogg file to my server and setting the source attribute to the remote location, but this process of uploading just to re-download seems awfully redundant (and it would also require some clever waste management on my part to avoid cluttering up the server). However, I'd REALLY like to find a way to make this client-side encoding strategy work. It would be nice if there were a way to convert the Firefogg output to a Data URI... perhaps that would get around the security issue.
Does anyone have any suggestions for how to handle this? Keep in mind that I'm willing to ditch Firefogg if there's a better strategy available.