jwplayer: using seek(), onTime() and stop() to play part of the video

感情迁移 提交于 2019-12-11 07:12:51

问题


I am using latest JW Player cloud hosted version.

I need to seek the video to start from certain position and stop at certain position using seek(), onTime() and stop().

jwplayer().onReady(function() { 
    jwplayer().seek(300).onTime(function(event) {
        if(event.position>330) {
            jwplayer().stop();
        }
    });
});

The video starts and stops with the above command, but if the user clicks on play button again, it starts from beginning instead of the time specified in seek().

I have advertisement associated with this video.

Any help!

Thanks


回答1:


you could try using onBeforePlay() method, its fired just before playing, as:

jwplayer('player').setup({
        ......
    });
jwplayer().onBeforePlay(function(){ 
    jwplayer().seek(300); 
}); 


来源:https://stackoverflow.com/questions/24751036/jwplayer-using-seek-ontime-and-stop-to-play-part-of-the-video

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