How to play multiple mp3 files with Jplayer?

1.4k views Asked by At

Here i'm using Jplayer an open source plugin for mp3 player.

myPlaylist.add({
  title:"Tempered Song",
  artist:"Miaow",
  mp3:"http://www.jplayer.org/audio/mp3/Miaow-01-Tempered-song.mp3",
});

But suppose If i've three anchor tag which contains three different music.

<a href="#">This is song 1</a>
<a href="#">This is song 2</a>
<a href="#">This is song 3</a>

Obviously, i cannot put the music URL into href. After click, it'll start download automatically or open window media player.

So, How do you put three different music source file into this jquery script? Or what do you use for playing mp3 files rather using anchor tag or not?

myPlaylist.add({
      title:"<Song name>",
      artist:"<singer name>",
      mp3:"<MP3 URL of three different song>",
    });

I want to play these three different mp3 files into one player but confused. I'm unable to find in google that jplayer tend to use different multiple mp3 files with jplayer. Please help how to do that?

HELP, WOULD BE APPRECIATED!!

1

There are 1 answers

0
Riad On BEST ANSWER

this is easy without anchoring with jquery attr.

<a href="#" music-url="songs_music_url">This is song 1</a>

In jquery:

myPlaylist.add({
  title:"<Song name>",
  artist:"<singer name>",
  mp3:$('a').attr('music-url'),
});