# MP3 Player v2 - XML

**URL:** <https://forum.kirupa.com/t/mp3-player-v2-xml/44539>\
**Category:** design\
**Created:** [March 4, 2004, 8:25pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539 "2004-03-04T20:25:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voetsjoeba](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@Voetsjoeba](https://forum.kirupa.com/u/Voetsjoeba)\
**Post date:** [March 4, 2004, 8:25pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/1 "2004-03-04T20:25:36Z")

</div>

Hi Kirupians 🙂

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](http://voetsjoeba.com/v2XML.html).

Feel free to report any bugs.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 11, 2004, 7:44pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/2 "2004-03-11T19:44:51Z")

</div>

I was waiting for you 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2004, 3:51pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/3 "2004-07-30T15:51:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2004, 3:57pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/4 "2004-07-30T15:57:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2004, 4:08pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/5 "2004-07-30T16:08:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2004, 5:18pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/6 "2004-07-30T17:18:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2004, 5:27am UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/7 "2004-07-31T05:27:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 2, 2004, 5:18am UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/8 "2004-08-02T05:18:30Z")

</div>

AWESOME

very kind of you to share the source.

I built a similar media player  
[http://www.southernmayhem.com](http://www.southernmayhem.com)

check it out

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 2, 2004, 6:39am UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/9 "2004-08-02T06:39:17Z")

</div>

Nubs - thanks 🙂  
tony - Not bad ! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 3, 2004, 10:17pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/10 "2004-08-03T22:17:12Z")

</div>

> [@Voetsjoeba](#):
>
> Then your XML file is not loading correctly. Make sure the paths are all correct.

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 3:40am UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/11 "2004-08-04T03:40:38Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 8:12am UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/12 "2004-08-04T08:12:02Z")

</div>

> [@Flash Gordon](#):
>
> [/QUOTE][QUOTE=Flash Gordon]What do you mean paths?

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

> [@Flash Gordon](#):
>
> The songs in the xml file or the xml file itself?

\> Both.

> [@Flash Gordon](#):
>
> How can I change the target url of the xml file?

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

> [@Flash Gordon](#):
>
> Also does it matter that the player is inside an MC?

\> 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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 8:16am UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/13 "2004-08-04T08:16:49Z")

</div>

> [@plantain\_tart](#):
>
> 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!

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);

```auto
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();
 };

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 11:45am UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/14 "2004-08-04T11:45:54Z")

</div>

> [@Voetsjoeba](#):
>
> \> The path to the XML file, the paths of the mp3’s inside the XML file, and the paths inside the FLA.

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.

> [@Voetsjoeba](#):
>
> \> In the ActionScript, where it loads the XML (at the bottom).

Which bit? Can you indicate where?

```auto
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);
};

```

> [@Voetsjoeba](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 12:02pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/15 "2004-08-04T12:02:19Z")

</div>

> [@Flash Gordon](#):
>
> 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.

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

> [@Flash Gordon](#):
>
> Which bit? Can you indicate where?
> 
> ```auto
> 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);
> };
> 
> ```

Yup.

> [@Flash Gordon](#):
>
> If the whole player is inside a single MC do I have to change anything?:puzzled:

> [@Voetsjoeba](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 12:55pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/16 "2004-08-04T12:55:06Z")

</div>

It stil says:

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 1:22pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/17 "2004-08-04T13:22:15Z")

</div>

Can you send me your files ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 2:07pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/18 "2004-08-04T14:07:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 2:27pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/19 "2004-08-04T14:27:06Z")

</div>

Here’s a zip of the fla and the playlist xml, Voets.  
[**www.freewebs.com/shocasesite/ZipforVoetsjoeba.zip**](http://www.freewebs.com/shocasesite/ZipforVoetsjoeba.zip)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2004, 6:19pm UTC](https://forum.kirupa.com/t/mp3-player-v2-xml/44539/20 "2004-08-04T18:19:35Z")

</div>

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

[Next page](https://forum.kirupa.com/t/mp3-player-v2-xml/44539.md?page=2)
