Unknown error caused by videojs library

2

The script works fine, 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

    
asked by anonymous 31.08.2016 / 16:34

1 answer

2

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

 $(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();
            }
        });
  });
    
31.08.2016 / 16:57