HTML5视频播放器阻止寻找 [英] HTML5 video player prevent seeking

查看:150
本文介绍了HTML5视频播放器阻止寻找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一系列视频教程,并希望阻止用户寻求前进和跳过部分。我将使用将用于桌面和iPad浏览器的HTML5视频播放器。理想情况下,我也希望能在iPhone上工作,但是我意识到,由于使用iPhone视频播放器,您无法控制手机上的视频。

I'm creating a series of video tutorials and would like to prevent users from seeking forward and skipping sections. I'll be using an HTML5 video player that will be used for desktop and iPad browsers. Ideally, I'd like this to work on the iPhone as well, but I realize you have no control over the video on the phone since it uses the iPhone video player.

如何防止用户寻求HTML5视频播放器?

How can I prevent users from seeking forward on an HTML5 video player?

推荐答案

Video.js的另一个例子:

Another example for Video.js:

videojs('example_video_1').ready(function(){
  var player = this;
  var previousTime = 0;
  var currentTime = 0;
  var seekStart = null;

  player.on('timeupdate', function(){
    previousTime = currentTime;
    currentTime = player.currentTime();
  });

  player.on('seeking', function(){
    if(seekStart === null) {
      seekStart = previousTime;
    }
  });

  player.on('seeked', function() {
    if(currentTime > seekStart) {
      player.currentTime(seekStart);
    }
    seekStart = null;
  });
});

这篇关于HTML5视频播放器阻止寻找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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