Wowza Community

How to add download button?

I want to add a download button to save the vod from jwplayer. Now my code likes this:

'<div id="'+ val.vid +'">' + '</div>' + '<script>' + 'var player = jwplayer(\''+ val.vid +'\');' + 'jwplayer("'+ val.vid +'").setup({playlist: [{' + 'stereomode: \''+ val.mode + '\',' + 'file: "'+ val.url +'",' + 'image: "'+ val.poster +'",' + 'height: 360,' + 'width: 640' + '}]});' + 'player.addButton(' + '"//icons.jwplayer.com/icons/white/download.svg","Download Video",' + 'function() {' + 'window.location.href = player.getPlaylistItem()[\'file\'];' + '},' + '"download");' + '</script>

I have created a JSON file to let jquery read the data. val.url is the video file resource. My url is :

http://172.16.218.23:1935/vod/_definst_/Videos/aim/mp4:162782R_Lenovo_Des.mp4/playlist.m3u8

And after I click my download button a video named playlist will be downloaded. But it cannot open.

So how should I solve this problem?

Hi, you can’t play the m3u8 file on local pc, if you didnt downlaod all *.ts file defined in chunk.m3u8. Even if you download m3u8 + ts, it’s not a good practice for watching video on local. You should let your client download mp4. For downloading mp4,

I suggest two way