所以这是玩家的支持
jwplayer("flvplayer").setup({
file: "$direct_link",
flashplayer: "$c->{site_url}/player/$name.swf",
image: "$file->{video_img_url}",
duration:"$file->{vid_length}",
width: $file->{vid_width},
height: $file->{vid_height},
provider: 'http',
modes: [ { type: "flash", src: "$c->{site_url}/player/$name.swf" },{ type: "html5", config: {file:'$direct_link','provider':'http'} }, { type: "download" } ] });
我想添加一个下载链接按钮,例如本网站上的播放器,例如>> http://www.mp4upload.com/a6hxfn9hdxuy
你们能帮助我吗?
之前感谢:D
答案 0 :(得分:1)
这很容易做到 - http://support.jwplayer.com/customer/portal/articles/1436999-example-adding-a-download-button
<script>
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()['file'];
},
//And finally, here we set the unique ID of the button itself.
"download"
);
</script>
答案 1 :(得分:0)
我认为这是针对JW5的。这是您可以使用的插件,将此文件另存为download.js:
(function(jwplayer){
var template = function(player, div, config) {
var assets = {
download: "http://www.longtailvideo.com/sites/default/files/download.png"
}
var goDownload = function() {
var item = player.getPlaylistItem();
if(item['downloadlink']) {
document.location = item['downloadlink'];
} else if(config.link) {
document.location = config.link;
} else {
document.location = item.file;
}
};
function setup(evt) {
player.getPlugin("dock").setButton(
'downloadButton',
goDownload,
assets.download
);
};
player.onReady(setup);
this.resize = function(width, height) {};
};
jwplayer().registerPlugin('download', template);
})(jwplayer);