Video.js jQuery breaks video / pause functions in Firefox

I am trying to use video.js to prevent fast-forward, but to allow fast-forward, for mp4 video on the Moodle site. The following script works in Chrome and Opera, but not in Firefox:

window.onload = function() {
  if ($('iframe').length > 0) {

    $('iframe').ready(function() {
      var videoPlayer = $('iframe').contents().find('video')[0];

      var cssLink = document.createElement("link")
      cssLink.href = "https://vjs.zencdn.net/5.0/video-js.min.css";
      cssLink.rel = "stylesheet";
      cssLink.type = "text/css";
      $('iframe').contents().find('head').append(cssLink);

      videojs(videoPlayer, {}, function() {
        var vjsPlayer = this;
        $('iframe').contents().find('video').prop('controls', 'true');
        $('iframe').contents().find('div .vjs-big-play-button').html('');
        $('iframe').contents().find('div .vjs-control-bar').html('');
        $('iframe').contents().find('div .vjs-caption-settings').html('');

        var currentTime = 0;

        vjsPlayer.on("seeking", function(event) {
          if (currentTime < vjsPlayer.currentTime()) {
            vjsPlayer.currentTime(currentTime);
          }
        });

        vjsPlayer.on("seeked", function(event) {
          if (currentTime < vjsPlayer.currentTime()) {
            vjsPlayer.currentTime(currentTime);
          }
        });

        setInterval(function() {
          if (!vjsPlayer.paused()) {
            currentTime = vjsPlayer.currentTime();
          }
        }, 1000);
      });
    });
  }
}

In Firefox, the desired effect is achieved (forward search does not change the time on the video, but reverse search does), however, the playback / pause functions are violated. If I searched an odd number of times in any direction, the video pauses and only plays when I hold the play button. If I searched an even number of times (including zero), the video plays, but the pause button does nothing. I get the same results in Microsoft Edge and posted a question about this .

type="video/mp4" , . , , , . / ? , , scr html .

<video> Chrome:

<video autoplay="" name="media" id="vjs_video_3_html5_api" class="vjs-tech" controls=""><source src="https://localhost/pluginfile.php/26769/mod_resource/content/4/Sample%20Video.mp4" type="video/mp4">
  <source src="https://localhost/pluginfile.php/26769/mod_resource/content/4/Sample%20Video.mp4" type="video/mp4">
</video>

<video> Firefox:

<video controls="" class="vjs-tech" id="vjs_video_3_html5_api" style="position:absolute; top:0; left:0; width:100%; height:100%" autoplay=""></video>

, , AddType video/mp4 .mp4 .htaccess, , Moodle. .htaccess:

deny from all
AllowOverride None
Note: this file is broken intentionally, we do not want anybody to undo it in subdirectory!

?

- mp4 Firefox?

+1

Source: https://habr.com/ru/post/1625225/


All Articles