未捕获的错误:INVALID_STATE_ERR:带有webkitEnterFullScreen的DOM异常11

时间:2012-07-10 12:27:12

标签: javascript jquery html5 webkit html5-video

$(document).ready(function(){
        var url = 'video.mp4'
        var video = $(document.createElement('video'))

        video.attr("width", 300);
        video.attr("height", 150);
        video.attr("src", url);
        video.attr("controls", true);
        video.attr("id", "video");

        video[0].addEventListener("play", function() {  }, false);

        video[0].play();
        video[0].webkitEnterFullScreen();

        $('body').append(video);

    })

未捕获错误:INVALID_STATE_ERR:DOM例外11

我做错了什么?

1 个答案:

答案 0 :(得分:0)

此错误表示视频未加载,请确保视频文件的路径正确且视频已加载,然后您可以尝试:

if (document.mozFullscreen) {
    video.mozRequestFullScreen();
}

if (document.webkitIsFullscreen) {
    video.webkitEnterFullScreen();
}