Skip to content

Instantly share code, notes, and snippets.

@jrell26
Created November 11, 2017 22:52
Show Gist options
  • Select an option

  • Save jrell26/3e73af65d97747556456aecbd5555a9f to your computer and use it in GitHub Desktop.

Select an option

Save jrell26/3e73af65d97747556456aecbd5555a9f to your computer and use it in GitHub Desktop.
<script type="text/javascript">
var player = jwplayer('player');
player.setup({
playlist: 'https://cdn.jwplayer.com/v2/media/8L4m9FJB'
});
player.addButton(
//This portion is what designates the graphic used for the button
"//icons.jwplayer.com/icons/white/download.svg",
//This portion determines the text that appears as a tooltip
"Download Video",
//This portion designates the functionality of the button itself
function() {
//With the below code, we're grabbing the file that's currently playing
window.location.href = player.getPlaylistItem()['file'];
},
//And finally, here we set the unique ID of the button itself.
"download"
);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment