jw player resume after refresh

别等时光非礼了梦想. 提交于 2019-12-24 05:04:55

问题


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

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

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

play.


回答1:


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));
        }
    }
});

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.

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);
        }
    }
});


来源:https://stackoverflow.com/questions/8929691/jw-player-resume-after-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!