Multiple playlists - One player

992 views
Skip to first unread message

P Siemens

unread,
Aug 14, 2010, 10:01:45 PM8/14/10
to jPlayer: the CSS styleable jQuery audio player plugin
Is there a way to switch between different playlists, but still using
one player instance? I am trying to create player that can play 3
different albums (3 separate playlists), and I want to be able to
switch albums with the click of a button, preferably without
refreshing the page. I was thinking that each playlist could be in a
separate div, and simple show/hide calls could be used to toggle which
div is being displayed. The problem is that I can't find a way to load
more than one playlist. I've been looking around and there doesn't
seem to be any documentation on multiple playlists, can anybody help
me out?

Thanks in advance,

Peter

P Siemens

unread,
Aug 14, 2010, 10:36:27 PM8/14/10
to jPlayer: the CSS styleable jQuery audio player plugin
I'm not very experienced with JS and even less with jQuery, so this
may not be possible, but I think I have an idea for playing multiple
albums.

In the "myPlaylist" array, each entry has a "name:", "mp3:", and
"ogg:" field. What if another optional field were to be added titled
"cat:" or "album:" and could be used to sort the audio files into
separate albums? Then when the playlist is displayed on the page, only
the files that are part of the currently selected album would be
displayed. I'm not sure how the player would know which album is
currently selected...perhaps by reading a parameter in the url? Again,
my knowledge of JS is limited, but could somebody tell me if this is
possible?

Thanks again,

Peter

Mark P

unread,
Aug 15, 2010, 1:30:53 PM8/15/10
to jPlayer: the CSS styleable jQuery audio player plugin
Hello Peter,

jPlayer deals with the audio and helps with the standard controls like
play, pause, and the volume.

You question is more to do with the demo 2 playlist demo code. In our
example, we give a single playlist. How you go about implementing
multiple playlists has many solutions, depending on what you want to
achieve.

For example, 1 solution that springs to mind is that you have 3
different myPlayList objects. ie., Crudely you could use: myPlayList1,
myPlayList2 and myPlayList3. Then when you switch between the
playlists, you set myPlayList to equal the selected playlist, 1 2 or
3. You would then reset the playItem, which selects the 1st track in
the playlist and finally refresh the playlist display using the
function already there, displayPlayList().

You could do your suggestion, but I think it might be a bit
complicated for your 1st go at a solution. Especially since you state
you are not that experienced. Basically though, to minimise the effort
you could have a masterPlaylist that contains everything... Then when
you initialize or change the playlist, you run a search through the
playlist and put the results into myPlaylist. You would then reset
playItem to zero and use displayPlayList() again to refresh the
display.

My suggestions have revolved around using the existing demo 2 code and
adding a bit on to perform your functionality.

Let us know how you get on.

If you require some extra guidance as you develop this project, them
please remember to post your project online somewhere and give us the
link. Wading through 1000 lines of code in an email is a gruelling
affair.

Best regards,
Mark P.
Message has been deleted

Moran Monovich

unread,
Oct 11, 2012, 5:29:34 AM10/11/12
to jpl...@googlegroups.com
Hi
can you please give me an example how can I do this? this thing is really difficult to implement.

Mark Panaghiston

unread,
Oct 12, 2012, 6:04:02 AM10/12/12
to jpl...@googlegroups.com
This is an old thread. The playlist functionality has now been added as an add-on and I gave it a lot more functionality.
It is, however, only a starting point since supporting all the options people desire would make it about 10GB. OK, I exaggerate ;)

See the docs here for jPlayerPlaylist:
http://jplayer.org/latest/demo-02-jPlayerPlaylist/

You can now change between playlists easily.

Moran Monovich

unread,
Oct 13, 2012, 4:28:52 AM10/13/12
to jpl...@googlegroups.com
Thank you, how could I have missed that :) this is definitely will solve my issues. 
Reply all
Reply to author
Forward
0 new messages