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?