does Streaming MP3s work in flash MX?
i have been trying to get an mp3 player i made working and its fine when i open the page on my computer the songs play etc
but when uploaded to my site they dont play i think this is cause the MP3s are large and either not downloading or taking to long.
So how do you get MP3s to stream dynamicallyif there not attached to the movie itself.
heres my code…
[AS]Mysound = new Sound();
this.button1.onPress = function() {
_level1.Mysound.loadSound(“I_Used_To_Write_Songs.mp3”, false);
_level1.Mysound.start(0);
};[AS]
I have three of these buttons which dynamically load an MP3 from external source however as i said it doesnt work when posted to my site??
Could it be something simple like the bandwidth limit of my site??
or is it just impossible to do and if so whats the next best way of making an MP3 player preferably without attaching the MP3 to the movie (1 of them alone is 3mbs)
Go here http://www.kirupa.com/developer/mx/loading.htm#Load%20.mp3%20dynamically%20with%20Flash%20MX:
Should answer your question
hmm it only applies to ‘loadmovie’
not ‘loadSound’.
so how do i insert a proper target path for dynamically loaded swf’s !
or should it work as it is if the MP3 files are in the same directory as my SWF files…??
scroll down the page - it’s at the bottom
DOH…!!
ok will check it out , thanks man…
ok checked it out and now a bigger question.
I now know my code should work fine for an mp3 player i have BUT i need a preloader which will appear only when the sound the mp3 track is loading , is there a way of doing this??
I know how to create conventional movie preloaders and tried changing the code to check for mp3 rather than movies but couldnt get it to work.
So is there a way of making a preloader for dynamically loaded MP3 files??
Sorry dude, I am not too sure, I just know how to stream them, I have never tried creating a pre-loader for an mp3
but you are streaming it anyway - why use a preloader?
Ok i just made this very same thing at www.pbcyouth.net in the radio section. (Its not a true radio, but you know what i mean)
Here is the basic process:
Create a interface for your MP3 player save it something like interface.swf
Now you need to create a seperate swf for each mp3 that you want to use. I know it sounds tedious but it will take the file size from about 4 MB for an MP3 to about 400K (give or take)
back in interface.swf use the load movie command to call in each movie as “tracks”
thats the basic idea. If anybody has any interest in this, then I will create a full tutorial with images and such.
yeah so i know im streaming them but they dont play until finished loading in!!
And admiral thanks for the tip but i already thought of that and was just wondering if anyone could come up with a dynamically streaming mp3 player with preloadr for he MP3 filw size
did you check the box that says SYNC and make it say Stream?
Hey admiralskeet you sound like you might be able to help so i’ll explain what im trying to do here ok…
I am creating (or trying to anyway) an MP3 player which loads the M3 files dynamically (not attached to the movie but load from external source) I have this working, and my MP 3 player also has a volume bar. But problem is while the MP3 track is loading i cannot think of a way to represent this fact to the user!!
I dont think a preloader bar for an external MP3 is possible but im sure there must be a crude way of doing it…
interested in helping ?? cjheck this out
http://www.freewebs.com/faroutonline/tests/Rake.html
my version of it so far (the buttons have no labels yet but click one of the MP3 buttons and wait a while (as it loads in a 3mb track) then click it again now the movie has loaded the track and if you use the volume slider youll see it works just need a way of conveying the loading process…!!
ok here is the best way I know to do it…
create a new movie, give it to layers. Name the bottom layer sound and the top layer actions.
Go to File -> Import to Library and then choose the mp3 you want (i’m gonna use example.mp3)
your library should now contain example.mp3…Double click on the speaker icon next to it in the library. A dialog box will appear. Uncheck “use imported mp3 quality” if it is checked and then choose the bitrate to be 20kbps and make sure compression says Mp3. Click update then okay.
On your main timeline make 3 keyframes in the sound layer,
click on keyframe 3:
at the bottom of the screen in the properties inspector use the sound drop down to choose “example.mp3” from the drop down list (you could also drag the mp3 from the library if you wished)
Make sure that sync says stream and effect is none (unless you want an effect then change it to what you wish)
now scroll to the end of your sound layer (all the way to the right in the timeline) check to see if you need to add more frames to your sound layer so that the sound can fully play. Add the same amount of frames to your actions layer.
In the very last frame of the actions layer insert a blank keyframe, click on it and in hte properties inspector give it a frame label of “end”
OK now go back to frame 1 of the actions layer and use the following actionscript:
ifFrameLoaded(“end”) {
gotoAndPlay(3)
}
on frame 2
gotoAndPlay(1)
what this does is create a loop taht loops between those two frames until your movie is loaded . Its a basic preloader that uses frame labels to make sure that all the frames in your movie are loaded before it starts playing. If you want a preloading animation put it on another layer and make it on only frames 1 adn 2.
Publish this movie. Once this movie is published you can use the load movie command to load it inot another movie. But it will still preload itself before playing.
Hope this helps and I hope you can understand it…need anything else let me know.
thanks for the help man but i want an MP3 player which loads big MP3 files externally, and ive done it too!!
figured it out with help of a guy at Actionscript.org.
Check it out at
http://www.freewebs.com/faroutonline/Tests/Rake.html
Ignore the very slow download times as thats my host not the player!!