JWPlayer prevent跳跃着,除非已经看过 [英] JWPlayer Prevent SKipping forward unless already watched

查看:250
本文介绍了JWPlayer prevent跳跃着,除非已经看过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JWPlayer 5.4,它是使用JavaScript API的页面上进行设置。

I'm using JWPlayer 5.4 and it's setup on the page using the javascript API.

我想要做的就是让这个用户可以快进/ rewing通过搜索栏只有当他们已经​​玩过视频的那部分。

What I'd like to do is make it so that users can fastforward/rewing via the seek bar ONLY if they have already played that part of the video.

所以,如果一个用户正在观看的第一次,他们不能跳过超越当前位置的视频,但他们可以寻求前进和后退的地方背后影片播放,直到

So, if a user is watching the video for the first time they can't skip beyond the current position, however they can seek forward and back behind where the video played up until.

我的API准时事件等,努力尝试和制定出数学,使这项工作。

I'm struggling with the API onTime events etc. to try and work out the Math to make this work.

有谁知道怎么可以这样做。

Does anyone know how this could be done.

感谢

推荐答案

我发现这一段时间回来,大概就JWplayer论坛。我想我平添了几分对播放列表。
所以万一你或其他人还在寻找一个答案,考虑添加的东西,如:

I found this a while back, probably on the JWplayer forum. I think I added a bit about the playlist. So just in case you or others are still looking for an answer, consider adding stuff like:

var maxPlayPosition = 0.0;
var seeking = false;

jwplayer().onTime(function(event) 
{
    if (!seeking) 
    {
        maxPlayPosition = Math.max(event.position, maxPlayPosition); 
    }
})
.onPlaylistItem(function()
{
    maxPlayPosition = 0.0;
})   // consider using only if you have playlists
.onSeek(function (event) 
{
    if (!seeking) 
    {
        if (event.offset > maxPlayPosition) 
        {
            seeking = true;
            setTimeout(function ()
            {  
               jwplayer().seek(maxPlayPosition);
            }, 100);
        }
    } 
    else 
    {
        seeking = false;
    }   
 });

这篇关于JWPlayer prevent跳跃着,除非已经看过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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