new YTPL(/* id */, /* options */);
new YTPL('player', {list: 'SPOHbM4GGWADc5bZgvbivvttAuWGow6h05'});
Customize the player with the following options
- ####list (required)
For a YoutTube Playlist, set list = PlaylistID.
For a custom list of videos, set list = array of query strings each with the following form ('video_id=W&author=X&title=Y&thumbnail=Z').
- ####video_id (optional)
YouTube video ID. Playlist will begin with this video. If left blank, playlist will begin on first video.
- ####autoplay (optional)
If true videos will play as soon as they are loaded. Defaults to false.
- ####shuffle (optional)
A number (should be a number from a shuffle event, but any 3 digit number will do) to shuffle the videos. If left blank the videos will not be shuffled.
- ####playerw (optional)
Width of the YouTube player. Defaults to 640.
- ####playerh (optional)
Height of the YouTube player. Defaults to 360.
- ####playlistw (optional)
Width of the playlist. The playlist's height is always the same as the YouTube player's height. Defaults to 303.
- ####ease (optional)
To hide the playlist until the user interacts with the YouTube player set easing = 2 element array. The first element being on of the following strings 'linear', 'sin', 'bounce', or 'elastic'. The Second element being the run time of the animation in seconds. Defaults to false.
var ytpl = new YTPL('player', {list: 'SPOHbM4GGWADc5bZgvbivvttAuWGow6h05'});
ytpl.add_listener(YTPL.PLAYLIST_READY, function(obj) {
console.log('playlist ready');
});
- ####YTPL.AUTOPLAY
Fired when autoplay is toggled. obj.autoplay will be true/false.
- ####YTPL.SHUFFLE
Fired when shuffle is toggled. obj.shuffle will have the shuffle seed if shuffle is on, or will be undefined.
- ####YTPL.PLAYLIST_READY
Fired when playlist is loaded.
- ####YTPL.PLAYER_READY
Fired when player api is loaded.
- ####YTPL.VIDEO_SELECTED
Fired when a video is selected in the playlist. obj has following properties: video_id, title, author, thumbnail.