如何使用 JWPlayer 5.4 查找()然后暂停()

发布于 2024-10-13 10:43:03 字数 701 浏览 7 评论 0原文

有谁知道如何让 JW PLayer v5.4(Flash 渲染或 HTML5 渲染)在执行eek()命令后暂停?

当用户单击细粒度控制按钮(或使用向左或向右箭头键)时,我试图让视频向前或向后步进 0.01 秒。这样他们就可以更精确地捕捉帧抓取。

我不确定这是否可能,但我尝试了一些方法但没有运气。比如下面的:

var stepTo = jwplayer("video_player").getPosition() + 0.01;

jwplayer("video_player").seek(stepTo).onComplete(function(){
    jwplayer('video_player').pause();
});

And:

jwplayer("video_player").pause().seek(stepTo);

And:

jwplayer("jwplayer_container").seek(stepTo).pause();

And:

jwplayer("video_player").pause().play().pause();

我也看到'Shortcuts'插件有这个功能,但是那个插件还不兼容v5.4。

感谢您的任何帮助。

Does anyone know how to get JW PLayer v5.4 (either the Flash rendering or the HTML5 rendering) to pause after a seek() command?

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

And:

jwplayer("video_player").pause().seek(stepTo);

And:

jwplayer("jwplayer_container").seek(stepTo).pause();

And:

jwplayer("video_player").pause().play().pause();

I've also seen that the 'Shortcuts' plugin has this feature, but that plugin ins't compatible with v5.4 yet.

Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

原谅我要高飞 2024-10-20 10:43:03

@AJB -

一张票来添加为 5.6 播放器安排的“onSeek”活动。同时,最好的方法可能是这样的:

jwplayer("video_player").seek(stepTo);

var pauseOnSeek = true;
jwplayer.onTime(function() {
   if (pauseOnSeek) {
      this.pause();
      pauseOnSeek = false;
   }
});

如果 onTime() 事件在查找完成之前触发,您可以通过在定义 onTime() 处理程序之前设置超时来绕过它。

@AJB -

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

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.

纸短情长 2024-10-20 10:43:03

使用 JW Player 6,您可以执行以下操作以使视频在搜索后暂停:

jwplayer("vidPlayerDiv").onSeek(function () { jwplayer("vidPlayerDiv").pause(); });

With JW Player 6, you can do the following to cause the video to pause after seeking:

jwplayer("vidPlayerDiv").onSeek(function () { jwplayer("vidPlayerDiv").pause(); });
绳情 2024-10-20 10:43:03

这是 PabloS 代码的一个小变化:

jwp = var player = jwplayer('target').setup({
    file: '/some-file.mp3'
});

jwp.seek(position);

var pauseOnSeek = true;
jwp.onTime(function () {
    if (jwp.getState() === "PLAYING" && pauseOnSeek) {
        this.pause();
        pauseOnSeek = false;
    }
});

我必须编写更改源媒体文件的代码,而无需从头开始播放视频。我想在暂停时处理视频切换。当我在 onSeek 回调中使用 seekpause 时,它不起作用,因为视频仍在缓冲。像上面的代码一样在 onTime 回调中暂停就像一个魅力。

This is a little variation on PabloS code:

jwp = var player = jwplayer('target').setup({
    file: '/some-file.mp3'
});

jwp.seek(position);

var pauseOnSeek = true;
jwp.onTime(function () {
    if (jwp.getState() === "PLAYING" && pauseOnSeek) {
        this.pause();
        pauseOnSeek = false;
    }
});

I had to write code that changed source mediafile without starting video from the beginning. I wanted to handle switching video when it was paused. When I used seek and pause in onSeek callback it didn't work because video was still buffering. Pausing in onTime callback like in code above worked like a charm.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文