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
Parameters:
See jPlayer methods for parameters of each individual method.
Returns:
jPlayerJukebox
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"
});
Returns:
Boolean Flag that indicates whether operation was successful
Returns:
String Visual state of the player
Available states are:
minimized |
Minimized |
maximized |
Maximized |
hidden |
Hidden |
playlistOptions.shuffleOnLoop option.
Returns:
void
Returns:
void
Returns:
void
Parameters:
index Number Zero-based song index in the playlist
Returns:
void
Returns:
void
Parameters:
index Number Zero-based song index in the playlist
Returns:
void
Returns:
void
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 |
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
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