Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

add download button


Hi,

Is it posible


<script type="text/javascript">
jwplayer().addButton(
//This portion is what designates the graphic used for the button
"/uploads/myButton.png",
//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 = jwplayer().getPlaylistItem()['http:\\domain.com\archive\video.mp4'];
},
//And finally, here we set the unique ID of the button itself.
"download");
</script>

4 Community Answers

administratie

User  
0 rated :

Sorry, I was to fast with sumitting the post.
But is it possible to add a different video link instead of 'file'?
Now i get a playlist.m3u8 file, when I click the download buttom.
instead of an video.mp4 file.

joel

Andrew

JW Player Support Agent  
0 rated :

If you’re using HLS with the player, indeed we will trigger a download of this M3U8 file since it’s the file currently playing with the player. You can potentially use a static link if needed, rather than getting the file that is currently playing. For example:

window.location.href = “http://www.mysite.com/video.mp4” would trigger a download of this specific video file. It would make the setup a bit less dynamic, but would download whatever it was that you preferred.

administratie

User  
0 rated :

Hi Andrew,
yes it works!!
Less dynamic, but beter than to download a useless m3u8 hls file.

Actually the share function, with mediaID is for me much nicer, because you can use it in a listbar with playlist. With the "download button" script I can only provide one download file.

Is there a way to use the download button in a listbar for each playlist item like the share function?

or provide two download buttons with text 720P and 480P?

joel

Andrew

JW Player Support Agent  
0 rated :

Great to hear! This isn’t something built into the player, but with some metadata, you can hypothetically pull the information out of your playlist and display it similarly to:
http://support.jwplayer.com/customer/portal/articles/1543546-example-making-your-own-playlist-sidebar

This question has received the maximum number of answers.