问题
I tried getting a video to display fullscreen on iPad using HTML5, but the result I get is:
- First time click video is play
- 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