On iPad, video doesn't go fullscreen using HTML5

允我心安 提交于 2019-12-11 14:02:48

问题


I tried getting a video to display fullscreen on iPad using HTML5, but the result I get is:

  1. First time click video is play
  2. Second time click fullscreen video is play it will appear.

I can't get both the video to play and turn fullscreen when activated.

Here's the source I've been using:

$(document).ready(function() { 
    $("#te").bind('click', function() { 
        $('#myVideoTag')[0].play(); 
        $('#myVideoTag')[0].webkitEnterFullScreen(); 
    }); 
});

回答1:


I was running into the same issue, and setTimeout seems to be the best solution I've run into.

This is what is working for me:

note: the videoEnable function is called through an onclick attribute in the "a" tag

//define function

var videoEnable = function(videoCount) {

    //Play video
    $('video').get(videoCount).play(); 

    //Timeout before fullscreen registers
    setTimeout(function(){
        $('video').get(videoCount).webkitEnterFullscreen();
    }, 2000);
}

Is that what you are looking for?



来源:https://stackoverflow.com/questions/10595839/on-ipad-video-doesnt-go-fullscreen-using-html5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!