I'm creating a music player to be on my website and so far I have it set up as such:
The player is contained in a movieclip with a 'song progress bar', a pause and a play button.
The songs are played by clicking the song title in a list in the main stage (not contained in the player movie clip), which sends the music player to the frame in which the song starts.
My audio is set as event audio so that the play and pause buttons can be coded as play(); and stop(): respectively which will stop the main player movie clip thus yeilding the progress bar from moving further and the song from playing.
This works just fine, except for the following:
- When I select event as my audio type the quality reduces dramatically
- Having the audio files in my library and not obtained from some outside source (i.e on my website's server) causes the .fla file to be much larger as well as the .swf
- Being as my project is at 24 FPS and each song is represented in as many frames as it takesto play the song out, my music player at present has only 3 songs 'in it', and my frames in the movie clip are approaching 20,000 (this is VERY tedious to work with)
I'm sure there is a more efficient way of doing things, but my knowledge is limited. I'd imagine I can do something along the lines of loading .mp3's off of my website into the frame and the play pause buttons will enact more elaborate scripts that not only stop the progress bar but also stop the music from playing temporarily, or something like this. But I have no idea how to implement it! Any ideas for solutions please? Thank you very much
Importing your audio at runtime (meaning that the audio loads and you would or might use a preloader for the audio) will give you the great advantage of using audio of any length while on the timeline you are limited by Flash's memory. Research dynamic mp3 players online and you will come up with some topics. make sure to include searching for AS 3.0 in your query.
Yeah you REALLY don't want your audio files on the main timeline... load all the audio as external files using the sound class.
I'd also suggest you jump in and learn how to integrate xml into your Flash, so you can pull all the audio data from an xml playlist. That way, 3 songs or 30 songs.. it's still very simple to present a clear playlist choice to your viewers.
couple dozen or so songs... yet the audio player is only about 400kb! ... tiny!... that's because the songs are all external. Player is unique and customized for the client... all the controls you need.
And no... you don't need any type of a "preloader"... since the audio files bitrate are normally in the range of 160kbps - less than 300kbps bitrate. Of course this is assuming that you are using mp3 and not some monstrosity like a wave file... if you are.. convert it... right now! You DON'T what to be playing wave files as downloadable!
So if you choose a reasonable mp3 bitrate of 200kbps or so... almost all Internet connections nowdays are at least that fast and will download the audio file faster than it is being played.
Here is a very good source for mp3 player tutorial:
scroll down about 3/4 way and look for:
"Flash MP3 Player: Part 1"
should get you started.