HTML5视频无法在iPad上全屏显示

时间:2018-02-20 18:41:25

标签: ipad html5-video fullscreen html5-fullscreen

我在我的网站here上设置了HTML5视频。

除了iPad之外,它在每个(经过测试的)设备上都能完美运行。即,全屏按钮不起作用,视频不会全屏显示。

有什么想法吗?

我应该使用webkitbeginfullscreen吗?或者使用ontouchstart点击?

JS:

window.onload = function() {

// Video
var video = document.getElementById("video");

// Buttons
var playButton = document.getElementById("play-pause");
var muteButton = document.getElementById("mute");
var fullScreenButton = document.getElementById("full-screen");

// Sliders
var seekBar = document.getElementById("seek-bar");
var volumeBar = document.getElementById("volume-bar");


[...]

// Event listener for the full-screen button
fullScreenButton.addEventListener("click", function() {
    if (video.requestFullscreen) {
        video.requestFullscreen();
    } else if (video.mozRequestFullScreen) {
        video.mozRequestFullScreen(); // Firefox
    } else if (video.webkitRequestFullscreen) {
        video.webkitRequestFullscreen(); // Chrome and Safari
    }
});


[...]

}

0 个答案:

没有答案