在iPad上,视频无法使用HTML5全屏显示
问题描述:
我尝试使用HTML5在iPad上显示全屏视频,但我得到的结果是:
I tried getting a video to display fullscreen on iPad using HTML5, but the result I get is:
- 首次点击视频是播放
- 第二次点击全屏视频即将播放。
我不能同时播放视频并在激活后全屏显示。
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();
});
});
答
我遇到了同样的问题,而setTimeout似乎成为我遇到的最佳解决方案。
I was running into the same issue, and setTimeout seems to be the best solution I've run into.
这对我有用:
注意:videoEnable函数通过a标记中的onclick属性调用
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);
}
这就是你要找的吗?