Video监听(播放,暂停,进入/退出全屏)
播放var video = document.getElementById('videoPoster');fullScreen(videoContainer) {videoContainer.play();},暂停var video = document.getElementById('videoPoster');fullScreen(videoContainer) {videoContainer
·
播放
var video = document.getElementById('videoPoster');
fullScreen(videoContainer) {
videoContainer.play();
},
暂停
var video = document.getElementById('videoPoster');
fullScreen(videoContainer) {
videoContainer.pause();
},
进入/退出全屏
## 进入全屏
var video = document.getElementById('videoPoster');
fullScreen(videoContainer) {
videoContainer.webkitRequestFullscreen();
},
## 退出全屏
function checkFull() {
var isFull = document.fullscreenEnabled || window.fullScreen || document.webkitIsFullScreen ||
document.msFullscreenEnabled;
if (isFull === undefined) isFull = false;
return isFull;
}
$(window).resize(function() {
if (!checkFull()) {
console.log("退出全屏");
var video = document.getElementById("videoPoster");
video.currentTime = 0; // 更改当前播放的时间点
video.pause();
}
});
更多推荐


所有评论(0)