This is a really awesome mp3 player that I made to mimic an actionscript 2 xspf player, but built with actionscript 3 and flex… it’s great and open source!

Finally it’s here…

OPEN SOURCE FLEX XML MP3 PLAYER

Flex xml mp3 player

Basically you can specify an xml playlist from the url, and have it play whatever is in the playlist…

The links for the examples are on the right side.

You can also specify the playlist in the url if you’d like:

http://cctracker.axelscript.com/Examples/xspfPlayer/bin/xmlPlayer.cfm?playlist%5Furl=http://killtheheart.com/playlist.xml

here are the variables you can use:

  • playlist_url : the url of the xspf file to load
  • podcast_mode : (true/false) if true the playlist url could be an rss feed to a podcast and it will play the all of the podcasts
  • repeat_playlist : boolean value that make the repeats the playlist after the end
  • song_url : String the href location of a single song you want to play, when this is used playlist_url is ignored
  • song_title : the name of the song you want to use

The music player can also be used to play single mp3 files instead of playlists, the parameters are:

  • song_url : the url of the single mp3 you want to play
  • song_title : the text to replace the players default’s

and you could even create a custom playlist on your site (this link doesn’t work it’s an example) http://flexcoders.nl/someplaylist.xml

and as long as it was in the right format, it’s all good….

here is the format http://examples.axelscript.com/Examples/xspfPlayer/bin/data.xml

right click and view source to actually copy and paste xml…

It’s loosely based on the xspf (‘spiff’) standard, it’s an open source shareable playlist format…

Here is the documentation on it:

http://www.xspf.org/xspf-v1.html#rfc.section.4.1.1.2

here is another example of a playlist

http://www.killtheheart.com/playlist.xml

  • Things that i hope for
  • to get the podcast version relased
  • people will report bugs (the issues tab) on the google code site Google Code
  • people will report features they want on the google code site Google Code
  • Examples – Coming soon (hopefully people start to use it and email make me some tutorials)
  • How to Skin the mp3 player

xml details (listed alphabetically)

  • album
    • the album name of this track… leave blank if you wish this shows up in the big version on the bottom of the “now playing” view
  • annotaion
    • unused at the moment, please refer to xspf documenation for information
  • artist
    • the artist name of this track… leave blank if you wish this shows up in the big version in the middle of the “now playing” view
  • creator
    • the developer… this is just documentation in my eyes, but please refer to xspf docs
  • image
    • in the big version of the player, if you specify a url of the image you want, it will show on the left while the track is playing
  • info
    • there is an info button on the big version, it’s simply another URL you could specify, and it will produce a popup window for it.
  • link
    • there is an image in the big version, specify a URL here, and when you click on the album in the big version it will give you a popup to the address you specify.
  • location
    • the most import piece of the puzzle
    • the url of the song (can be a URL, or relative path)
  • timeEnd
    • use this to pause the song at a certain point, say you only want the user to listen to 0:15 – 0:20, make the timeEnd 20000 (not exact but close enough, it’s milliseconds)
    • specify a 0 to just play through the end
    • NOTE: it is milliseconds!
  • timeStart
    • use this to start the song at a certain point, say you only want the user to listen to 0:15 – 0:20, make the timeStart 15000 (not exact but close enough, it’s milliseconds)
    • specify a 0 to just play from the begining
    • NOTE: it is milliseconds!
  • title
    • this is the track title – it is displayed in the top of the ‘now playing’ view in the big version (note: doesnt necessarily have to be the track title it could just be whatever you chose to name the file… it’s up to you)
  • trackNum
    • unused at the moment, but could be used for documentation

Instructions

  1. Download whatever version you want (big/small) by clicking the links above
    • if your just using the product and dont care about the source, click on the links under Download section, that dont have the word “source”
  2. When you download it, there are 4 files
    • data.xml (sample xml file)
    • swfobject.js (swfobject.js used for including the swf file in your html/cfm/php/whatever else page) (NOTE: i’ll try to keep up on new versions of swfobject but no gurantees if you want the latest and greatest go to http://blog.deconcept.com/swfobject/
    • xmlPlayer(Small/Big).cfm (Small/Big depending on the version you downloaded… these are example cfm files to reference to for using swfObject to include your .swf… if you have any experience with using flash files on html pages, you should have not problem googling other ways besides swfobject)
    • xmlPlayer(Small/Big).swf (this is the actual swf file to use)
  3. Place those files in whatever folder you would like under your webroot and then run the page in a browser (http://yourdomain/whereyouputthefiles/index.cfm (if you dont have coldfusion, please open up the cfm file with wordpad, and fix the code, it’s pretty self explanatory, mostly it’s just html)
  4. When you run the page, a default playlist will start playing if you have not provided one on the url
  5. (i.e.) http://yourdomain/whereyouputthefiles/index.cfm?playlist_url=data.xml
  6. please submit bugs to the google code site! I WILL FIX THEM I PROMISE! (the issues tab) Google Code