|
||||||||||||
|
||||||||||||
|
Site Navigation Resourceful Links: |
I'll do my best on explaining on how to add a few lines in the the XSPF Players action script which would enable a random start function. I am assuming you know how to edit the xspf player in flash, I am also assuming you have a flash program to accomplish the following instructions. The following instructions should be all you need to know. If you can not get it to work then sorry, this should only be attempted by someone who has had some experience with editing the xspf player in flash. (Note: I used the old version of the xspf 0.2.1, so the action script may look a little different if you're using version 0.2.3) What you'll need: A Flash Program: Your best bet is obtaining Macromedia Flash Pro 8 from the Adobe Website. They offer a 30 day free trial. XSPF FLA, AS & SWF files: Those can be found on the sourceforge.net website. Just download the zip file and extract it's contents. Patience: You might not get it right away or even experience a few errors. But trust me this is pretty easy to do and with enough trial and error you might be able to do it with your eyes closed. :P Okay open up your flash program, Now open up the XSPF FLA file then open up the XSPF AS file. You should now have two tabs open on your flash program. Firstly you will want to edit the XSPF FLA file to your liking, color changes etc... Once completed save the edited changes (File / Save).
Now tab over to the xspf's action script and look for the following line: ![]() Add the line in green infront of it: if (randomstart){ randomTrack() }else Should look like the following once added, make sure there is a space between else and if. ![]() Now look for this next line: ![]() You will need to make a space there to add the following line: function randomTrack(){ track_index = random(playlist_size); loadTrack(); } Should look like this once added: ![]() Now you will want to check for any errors, just click the check mark on top: ![]() If everything was done correctly you should get this message: ![]() Now that you have added a random start function to the action script tab back over to the FLA file and click Window / Test Movie or just press Ctrl + Enter and click play on the XSPF player. You'll want to do this so that the new changes you made to the action script will take effect. Now for another important part you will need to add this line in the embed code: &randomstart=true Should look something like this when added: playlist_url=http://url_to_xspf_here.xspf&autoplay=true&randomstart=true All depends on what you have in your embed or what not, either way it should work. Additionally this only works for .xspf saved playlists. Just a reminder when your player is visited it will start on a random track each time however it will go in track order... i.e.... randomly starts on track 5 but continues in order onto track 6, 7, 8, 9 and so on. |
|
||||||||||