在网站上播放视频时未捕获(承诺)DOMException

时间:2019-08-08 01:14:19

标签: asp.net html5-video

我正在尝试使用Google vrview播放360视频,但是出现Uncaught(承诺)DOMException错误,有人可以帮忙吗?

我的html很简单:

<div id="vrview">

    </div>


<script src="//storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
<script type="text/javascript">


    function onVrViewLoad() {
        console.log("a");
        var vrView = new VRView.Player('#vrview', {
    video: 'http://storage.googleapis.com/vrview/examples/video/congo_2048.mp4',

            is_stereo: true,
            width: '50%',
            height: '50%',
            is_autopan_off: true,

        });



    }

   window.addEventListener("load", onVrViewLoad);

    var promise = document.querySelector('video').play();

    if (promise !== undefined) {
        promise.then(_ => {
        // Autoplay started!
    }).catch(error => {
        // Autoplay was prevented.
        // Show a "Play" button so that user can start playback.
    });
    }

</script>

0 个答案:

没有答案