gpt4 book ai didi

javascript - jw播放器刷新后恢复

转载 作者:行者123 更新时间:2023-11-30 06:00:29 26 4
gpt4 key购买 nike

如何让JW Player有一个“resume”或者“remember”的功能来标记最后的位置

电影的播放位置,回来看视频的时候还记得吗?所以,如果一个

观众在 2 小时的电影的 36:25 分钟停止观看电影,不得不下线,当

他们回去看电影,JW播放器会打开到正确的位置“继续”

播放。

最佳答案

这应该让你开始:
http://osric.com/chris/jwplayer/jwplayer5.4/ontime.html
该页面的 JavaScript 如下:

$(document).ready( function() {
jwplayer("container").setup({
file:"playlist.xml",
height: 300,
width: 400,
events: {
onTime: function(event) {
$('#timer').html(Math.floor(event.position));
}
}
});

该代码将一个id为“timer”的元素设置为当前位置的值。
然后您可以创建一个 cookie 来保存来自 JS 的变量。

编辑
您可以使用此链接来帮助使用 cookie 功能:
http://www.w3schools.com/js/js_cookies.asp

$(document).ready( function() {
jwplayer("container").setup({
file:"playlist.xml",
height: 300,
width: 400,
events: {
onPause: function(event) {
setCookie(event.position);
}
}
});

关于javascript - jw播放器刷新后恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8929691/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com