One of the cool new features of Flash Player 10 is that you can load files from the client without uploading them to the server.
The only limitation is that you`ll only be able to access the raw bytes of the file and there is no way to find out the filepath (see problem discussion here). The problem is that until now we cannot pass mp3 bytes to the sound object or the netstream class so there is no easy way to play mp3s locally on the client (without first uploading them to the server).
So here is a solution that uses the old trick of generating a SWF file in memory which contains the mp3 associated with a linkageId.
Check out my solution here
Note that some mp3s might not work as the Mp3Reader class is not very optimized but it should show the general steps to chieve the goal.
Let me know if it`s useful and if you could make any enhancements.
Next we`ll look into how to load two mp3s and mix them and save them as a wav (PCM) file.
Benjamin,
You are a rockstar! This is very useful and I am sure there are many people looking for how to do just this. I am glad to see you are going to be working on your blog more again.
Congratulations on the Community Expert achievement you deserve it!
Thanks for all your posts and help.
Arthur Nemirovsky
I ran into the same problem a while back while playing with flash 10 audio programming [ http://www.kelvinluck.com/2008/11/first-steps-with-flash-10-audio-programming/ ] and found a solution from Flexible Factory:
http://www.flexiblefactory.co.uk/flexible/?p=46
Cheers,
Kelvin
Great Example!!!…..I first saw it on the http://pixlr.com/ application where the user is directly able to edit the image without loading it through a server, Great going adobe.
Ben,
Great job. Have you tried to do the same to load a FLV or an MP4?
How would you do that?
Take care,
Gilbert
@Gilbert,
Did you got that working? I did an implementation of some processes, only to find at the last step that I couldn’t hook my processed bytes in any way to a player (without writing to disk and/or doing it for the whole file – not an option in my scenario).