jwplayer:使用seek(),onTime()和stop()播放视频的一部分 [英] jwplayer: using seek(), onTime() and stop() to play part of the video

查看:220
本文介绍了jwplayer:使用seek(),onTime()和stop()播放视频的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新的JW Player云托管版本.

I am using latest JW Player cloud hosted version.

我需要使用seek()onTime()stop()来搜索视频以从特定位置开始并在特定位置停止.

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

视频使用上述命令启动和停止,但是如果用户再次单击播放"按钮,则它将从头开始播放,而不是从seek()中指定的时间开始.

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.

任何帮助!

谢谢

推荐答案

,您可以尝试使用 onBeforePlay()方法,它在播放之前就触发了,例如:

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

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

这篇关于jwplayer:使用seek(),onTime()和stop()播放视频的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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