test jw player

function initPlaylist(player) { $.ajax(player.getPlaylist()).then(function(data) { var playlistWrapper = $('.playlist-wrapper'); var playlistTemplate = Handlebars.compile($('#out-player-playlist-template').html()); playlistWrapper.html(playlistTemplate(data));

playlistWrapper.on('click', '.playlist-item-link', setVideo.bind(this, data.playlist, player)); player.on('playlistItem', setActive); }); }

function setVideo(playlist, player, e) { var currentVideo = $(e.target).closest('a').data('mediaid'); var videoIndex = playlist.findIndex(function(video) { return currentVideo === video.mediaid; });

e.preventDefault();

player.playlistItem(videoIndex); }

function setActive(e) { var id = e.item.mediaid;

$('.playlist-item-link').removeClass('active') .filter(function(item) { return $(this).data('mediaid') === id; }) .addClass('active'); }

initOutPlayer('fMyGTc8v'); // End Playlist Shelf Example