API

Below is an example on how to use API method play to play first song in the playlist after the player has been initialized.

var jpjb = new jPlayerJukebox({
   'swfPath': '/js/jplayer', 
   'jukeboxOptions': {
      'onInitComplete': function(jpjb){
         // Play first song in the playlist
         jpjb.play(0);
      }
   }
});

Summary

Option Description
jPlayer Calls jPlayer method.
add Add a media item to the end of the playlist.
clear Clears the playlist but leaves links playable.
getViewState Gets visual state of the player.
next Moves to and plays the next item in the playlist.
parse Parses page and adds media links to the playlist.
pause Pauses the current item.
play Plays the item in the playlist.
previous Moves to and plays the previous item in the playlist.
remove Removes the item from the playlist.
select Selects the item in the playlist.
setViewState Sets visual state of the player.
showPlaylist Shows/hides the playlist.
shuffle Shuffles the playlist.

Details

jPlayer()
Calls jPlayer method

Parameters:
See jPlayer methods for parameters of each individual method.

Returns:
jPlayerJukebox

add(media, playNow)
Adds a media item to the end of the playlist

Parameters:
media Object Defines the media format URL, title, artist, poster and other properties.
playNow Boolean (Optional, default: false) Indicates whether media should start playing immediately.

Returns:
void

Example:

jpjb.add({
   title: "Your Face",
   artist: "The Stark Palace",
   mp3: "http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3",
   poster: "http://www.jplayer.org/audio/poster/The_Stark_Palace_640x360.png"
});

clear()
Clears the playlist but leaves links playable.

Returns:
Boolean Flag that indicates whether operation was successful

getViewState()
Gets visual state of the player.

Returns:
String Visual state of the player

Available states are:

minimized Minimized
maximized Maximized
hidden Hidden

next()
Moves to and plays the next item in the playlist. The behavior for the last item depends on the loop state, the shuffle state and the playlistOptions.shuffleOnLoop option.

Returns:
void

parse()
Parses page and adds media links to the playlist.

Returns:
void

pause()
Pauses the current item.

Returns:
void

play(index)
Plays the item in the playlist. Plays the current item if no parameter is given. A positive index plays items from the start of the playlist while a negative index plays items from the end.

Parameters:
index Number Zero-based song index in the playlist

Returns:
void

previous()
Moves to and plays the previous item in the playlist.

Returns:
void

remove(index)
Removes the item from the playlist. Removes all items if no parameter is given. A positive index removes items from the start of the playlist while a negative index removes items from the end.

Parameters:
index Number Zero-based song index in the playlist

Returns:
void

select(index)
Selects the item in the playlist. A positive index selects items from the start of the playlist while a negative index selects items from the end.

Returns:
void

setViewState(viewState, duration)
Sets visual state of the player.

Parameters:
viewState String Visual state of the player
duration Number (Optional, default: 0) Determines how long the transition effect takes to complete, in milliseconds

Returns:
void

Available states are:

minimized Minimized
maximized Maximized
hidden Hidden

showPlaylist(show, duration)
Shows/hides the playlist.

Parameters:
show Boolean Determines whether playlist should be shown
duration Number (Optional, default: 0) Determines how long the transition effect takes to complete, in milliseconds

Returns:
void

shuffle(shuffled, playNow)
Shuffles the playlist. Toggles shuffled setting if no parameters are given.

Parameters:
shuffled Boolean (Optional) Determines whether playlist should be shuffled or un-shuffled
playNow Boolean (Optional, default: false) Indicates whether media should start playing immediately

Returns:
void