1

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

它可以在除 iPad 之外的所有(经过测试的)设备上完美运行。即,全屏按钮不起作用,视频无法全屏显示。

关于原因的任何想法?

我应该使用 webkitbeginfullscreen 吗?或者使用 ontouchstart insted of click?

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
    }
});


[...]

}
4

0 回答 0