Created
June 30, 2017 15:57
-
-
Save georgechalhoub/338e5a5edec7315a80820e90b467e090 to your computer and use it in GitHub Desktop.
Retrieve the url(s) of the currently playing video of a playlist in JWPlayer 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Wait until jwplayer loads in the browser | |
jwplayer().on('ready', function(e) { | |
//Create the function to be launched based on button click | |
$("#playlistDownButton").click(function() { | |
//Get the index of the currently playing video | |
var getIndex = jwplayer().getPlaylistIndex(); | |
//Get the video object based on the index | |
var getObject = jwplayer().getPlaylistItem(getIndex); | |
//Get all sources inside the video object | |
var getSources = getObject.allSources; | |
//Loop inside the source | |
for (var i = 0; i < getSources.length; i++) { | |
//Alert every file name in the browser | |
window.alert(getSources[i].file); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment