我在我的网站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
}
});
[...]
}