MP3 Player v2 - XML

Hi Kirupians :slight_smile:

I’ve been promising this for a long time now - and here it finally is; MP3 player v2. I’ve made two versions - one with XML and one with PHP. This is the one with XML. Though many people have requested it, I did not make this version a streaming player. My main goal with this player was to write a more reliable core with more logical internal functioning to prevent bugs.

This version uses XML to store the song information, which is then read by Flash and processed. The URL itself is protected from the XML parser, so that no problems occur when using non-default characters in URLs.

This player is available to everyone - you are free to download and use it. Anyone can use and modify it freely.

The XML player can be seen in action here.

Feel free to report any bugs.

I was waiting for you :wink:

I have a problem. I have the xml playlist saved on my computer as ‘onlineplaylist.xml’ as it is called in the code. However the player doesn’t seem to be able to find it as it keeps telling me:

Error opening URL “file:///C|/My%20Documents/undefined”

What am I doing wrong here? Can anyone help me?

Does the song title show up or does it show undefined ? If it shows undefined, then it’s the XML file, if the song name shows up, then the path to the mp3’s is wrong.

song name show’s up ‘undefined’. I wn’t read your reply until at least Tuesday so thanx in advance. I’m off to my caravan.

Then your XML file is not loading correctly. Make sure the paths are all correct.

GOOD WORK MY FRIEND!!! awesome awesome awesome, exactly what i was looking for!

AWESOME

very kind of you to share the source.

I built a similar media player
http://www.southernmayhem.com

check it out

Nubs - thanks :slight_smile:
tony - Not bad ! :slight_smile:

Thanks Voets. I’ll try and put it right now.

[confused] What do you mean paths? The songs in the xml file or the xml file itself? How can I change the target url of the xml file? Where is it in the actionscript? Also does it matter that the player is inside an MC? [/confused]
Awaiting your reply, Paddy

I was wondering, is there a way to play a particular track by hard coding it in a button? Lets say I want to play track 7 in a play list of 7?

Thanks in advance!

> The path to the XML file, the paths of the mp3’s inside the XML file, and the paths inside the FLA.

> Both.

> In the ActionScript, where it loads the XML (at the bottom).

> You must make sure that you pass along the right movieclips to the class then. You’ll notice that in the code, right above the XML part, there is a list of movieclips. Make sure you have the correct paths there.

Replace the next prototype by this one, and then you can use it to play a specific song by targetting the instance of the class, ‘player’ and executing the next method, passing along the number you want:

player.next(7);

mp3Player.prototype.next = function(nr) {
     this.sound.stop();
     if(nr){
         this.songs.index = nr;
     } else {
         this.songs.index++;
         if (this.songs.index>this.songs.length-1) {
             this.songs.index = 0;
         }
     }
     this.showSongInfo();
     this.sound = new Object(new Sound(_root));
     this.sound.loadSound(this.songs[this.songs.index].url, true);
     this.sound.setVolume(this.curVolume);
     this.showLoaded();
     this.indicateStatus(1);
     this.indicateProgress();
 };

Do the mp3’s themselves have to be online or can I run a test with the ones on my hard drive? I’ve only got two of them online currently.

Which bit? Can you indicate where?

XMLRetrieve = new XML();
XMLRetrieve.ignoreWhite = true;
XMLRetrieve.load("[onlineplaylist.xml](http://www.freewebs.com/showcasesite/onlineplaylist.xml)"); ***[color=royalblue]<--Here?[/color]***
XMLRetrieve.onLoad = function() {
 for (var j = 0; j<this.firstChild.childNodes.length; j++) {
  songsArray.push({title:this.firstChild.childNodes[j].attributes.title, artist:this.firstChild.childNodes[j].attributes.artist, [url:this.firstChild.childNodes](http://www.kirupaforum.com/forums/this.firstChild.childNodes)[j].firstChild.nodeValue});
 }
 player = new mp3Player(songsArray, playerInterface, 1);
};

If the whole player is inside a single MC do I have to change anything?:puzzled:

You can test it with local sound files, but the sound will be loaded immediately then because it’s already “loaded” on your hd.

Yup.

It stil says:

Error opening URL “file:///C|/My%20Documents/undefined”
in the error panel.

Can you send me your files ?

I know this may be asking to much of you… I downloaded the streaming mx 2004 version i was wondering if there a way to display time remaining? …

I know in your streaming version, in the xml file you must specify how long the song is, can you display that data?

…again I know you’ve helped many people by sharing this file and if you don’t respond I would understand… How can I modify the code so that when a song is playing it can import the album’s cover art (.jpg file)? Any respond to would be greatly appreciated

Here’s a zip of the fla and the playlist xml, Voets.
www.freewebs.com/shocasesite/ZipforVoetsjoeba.zip

When I open the zip it tells me that “The archive is not valid” :confused: