如何使用JWPlayer 5.4进行seek()然后pause() [英] How to seek() then pause() with JWPlayer 5.4
问题描述
有人知道如何在seek()命令之后使JW PLayer v5.4(Flash渲染或HTML5渲染)暂停吗?
Does anyone know how to get JW PLayer v5.4 (either the Flash rendering or the HTML5 rendering) to pause after a seek() command?
当用户单击细粒度控制按钮(或使用向左或向右箭头键)时,我试图将视频向前或向后移动0.01秒.这样一来,他们可以以更高的精度捕捉帧抓取.
I'm trying to get the video to step 0.01 seconds forward or backward when a user clicks the fine-grain control buttons (or uses the left or right arrow keys). This is so they can snap a framegrab with better precision.
我不确定这是否可能,但是我尝试了一些运气不好的事情.如以下内容:
I'm not sure if this is even possible but I've tried a few things with no luck. Such as the following:
var stepTo = jwplayer("video_player").getPosition() + 0.01;
jwplayer("video_player").seek(stepTo).onComplete(function(){
jwplayer('video_player').pause();
});
并且:
jwplayer("video_player").pause().seek(stepTo);
并且:
jwplayer("jwplayer_container").seek(stepTo).pause();
并且:
jwplayer("video_player").pause().play().pause();
我还看到快捷方式"插件具有此功能,但是该插件尚不兼容v5.4.
I've also seen that the 'Shortcuts' plugin has this feature, but that plugin ins't compatible with v5.4 yet.
感谢您的帮助.
推荐答案
@AJB-
有一张票证,用于添加为5.6播放器安排的"onSeek"事件.同时,执行此操作的最佳方法可能是这样的:
There's a ticket to add an "onSeek" event scheduled for the 5.6 player. In the meantime, the best way to do this is probably something like this:
jwplayer("video_player").seek(stepTo);
var pauseOnSeek = true;
jwplayer.onTime(function() {
if (pauseOnSeek) {
this.pause();
pauseOnSeek = false;
}
});
如果在完成搜索之前触发onTime()事件,则可以通过在定义onTime()处理程序之前设置超时来解决该问题.
If the onTime() event fires off before the seek is complete, you may be able to hack around it by setting a timeout before defining the onTime() handler.
这篇关于如何使用JWPlayer 5.4进行seek()然后pause()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!