Unknown error caused by videojs library

Asked

Viewed 64 times

2

The script works normal, but the console is giving the following error:

'//@ sourceURL' and '//@ sourceMappingURL' are deprecated, Please use '//# sourceURL=' and '//# sourceMappingURL=' Instead. video.js:86 Uncaught (in Promise) Domexception: The play() request was Interrupted by a new load request.

Javascript:

$(function() {
        var myPlayer = videojs("player", {
            "controls": false,
            "autoplay": true,
            "preload": "auto",
            "width": 750,
            "height": 500
        });
        myPlayer.src({type: "video/mp4", src: '/videos/video.mp4'});
        //;
        var video = document.getElementById("player");
        video.setAttribute("oncontextmenu", "return false;");
        videojs.options.flash.swf = "/swf/video.swf";

        $(' .vjs-control-bar').remove();
        $('#player,#buttonVideo').click(function() {

            if (myPlayer.paused()) {
                myPlayer.play();
                $('#buttonVideo').hide();
            } else {
                myPlayer.pause();
                $('#buttonVideo').show();
            }
        });

    });

HTML:

 <video id="player" class="video-js vjs-default-skin" poster="/imagens/loader.gif"></video>

JSVIDEO DOCUMENTATION

1 answer

2


I solved the problem by changing the "autoplay" rule, because in Chrome I was not running "autoplay", without first completing uploading in the video Dom:

 $(function() {
        var myPlayer = videojs("player", {
            "controls": false,
            "autoplay": false, //tirei o autoplay
            "preload": "auto",
            "width": 750,
            "height": 500
        });
        myPlayer.src({type: "video/mp4", src: '/videos/MarcaTecBan.mp4'});
        if (myPlayer.paused()) {
           //liguei o autoplay
            myPlayer.play();
        }

        var video = document.getElementById("player");
        video.setAttribute("oncontextmenu", "return false;");
        videojs.options.flash.swf = "/swf/video-js.swf";
        $(' .vjs-control-bar').remove();
        $('#player,#buttonVideo').click(function() {

            if (myPlayer.paused()) {
                myPlayer.play();
                $('#buttonVideo').hide();
            } else {
                myPlayer.pause();
                $('#buttonVideo').show();
            }
        });
  });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.