我正在尝试同时添加多个视频级别(MP4和WebM)以及多个视频源(HQ和SQ),但我看到的所有脚本只包含一个选项。在这方面你能帮我吗?
例如,这里有多个来源的脚本:
<script>
jwplayer("myElement").setup({
playlist: [{
image: "/uploads/myPoster.jpg",
sources: [{
file: "/uploads/myVideo360.mp4",
label: "360p SD"
},{
file: "/uploads/myVideo720mp4",
label: "720p HD"
}]
}]
});
</script>
这里是多个级别的脚本:
enter code here<script type="text/javascript">
jwplayer("myElement").setup({
image:'http://d14nfturrc5hvw.cloudfront.net/70/192-webm-thumb-00001.png',
levels: [
{ file: "http://d1qr219t0s44x.cloudfront.net/70/192.webm", type:"video/webm" },
{ file: "http://d1qr219t0s44x.cloudfront.net/70/192.mp4", type:"video/mp4" }
],
width: '320',
height: '180'
});
</script>'
我需要像HQ和SQ中的wemb视频以及带有HQ和SQ的MP4视频那样合并两个级别和来源。 请帮助我如何可能,我尝试了几种方法,但没有找到正确的解决方案。感谢
最诚挚的问候, Ghazanfar Latif(加布) www.prebinary.com
答案 0 :(得分:2)
级别不是JW6的有效变量 - http://www.longtailvideo.com/support/jw-player/28834/migrating-from-jw5-to-jw6
我认为这应该可以作为一个设置:
<div id="myElement"></div>
<script>
jwplayer("myElement").setup({
playlist: [{
image: "/uploads/myPoster.jpg",
sources: [{
file: "/uploads/myVideo.mp4"
},{
file: "/uploads/myVideo.webm"
},{
file: "/uploads/myVideoHQ.mp4"
},{
file: "/uploads/myVideoHQ.webm"
}]
}]
});
</script>
然而,你现在真的只需要webM for Firefox for Mac和旧版Windows机器,因为Firefox在大多数情况下支持MP4。很确定我会说只需使用SD / HD MP4文件即可。
答案 1 :(得分:0)
我使用了@emaxsaun的答案并获得了真实的结果,但我通过以下代码更改了HD Quality Toggling标签。
<div id="myElement">Loading the player...</div>
<script type="text/javascript">jwplayer.key = "Your license Key";</script>
<script type="text/javascript">
jwplayer("myElement").setup({
playlist: [{
sources: [{
file: "http://techslides.com/demos/sample-videos/small.mp4",
image: "http://files.yyyy.com/users/201.jpg",
label: "720p",
}, {
file: "http://techslides.com/demos/sample-videos/medium.mp4",
image: "http://files.yyyy.com/users/201.jpg",
label: "820p",
}, {
file: "http://techslides.com/demos/sample-videos/large.mp4",
image: "http://files.yyyy.com/users/201.jpg",
label: "920p",
}]
}],
displaytitle: "true",
stretching: "fill",
preload: "auto",
width: "100%",
height: document.documentElement.clientHeight - 20,
});
jwplayer("myElement").onReady(function () {
jwplayer("myElement").play();
});
jwplayer().onDisplayClick(function () { jwplayer().setFullscreen(true); });
</script>