jw播放器刷新后恢复 [英] jw player resume after refresh

查看:110
本文介绍了jw播放器刷新后恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使JW Player具有恢复"或记住"功能以标记最后一个位置

how to make the JW Player have a "resume" or "remember" function which marks position of last

播放电影的位置,还记得回来时再次观看视频时的位置吗?因此,如果

play position of movie and remembers it when you come back to watch video again? So, if a

观看者在2个小时的电影中以36:25分钟的时间停止观看电影,并且不得不离线观看

viewer stopped watching a movie at 36:25 minutes on a 2 hour movie and had to go offline, when

他们返回看电影,JW播放器将打开到正确的位置并恢复"

they returned to watch movie, the JW player would open to the correct position and "resume"

播放.

推荐答案

这应该可以帮助您入门:
http://osric.com/chris/jwplayer/jwplayer5.4/ontime.html
该页面中的JavaScript如下:

This should get you started:
http://osric.com/chris/jwplayer/jwplayer5.4/ontime.html
The JavaScript from that page is as follows:

$(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中的变量.

That code sets an element with the id of "timer" to be the value of the current position.
You could then create either a cookie to save the variable from the JS.

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

Edit
You can use this link to help with the cookie function:
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);
        }
    }
});

这篇关于jw播放器刷新后恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆