背景资料:
单击每个视频缩略图图像将全屏播放视频,兼容跨浏览器
做了什么:
已创建以下附在下面的源代码
问题:
Chrome 可以全屏播放视频,但 IE 和 Microsoft Edge 无法播放视频
请参阅下面的源代码:
$("#MainVideo").data("number", Video);
console.log($("#MainVideo").data("number"));
var element = document.getElementById("MainVideo");
if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}else if (element.msRequestFullScreen) {
element.msRequestFullScreen();
} else if (element.RequestFullScreen) {
element.RequestFullScreen();
}
//This shouldnt affect
$('#MainVideo').bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
var state = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
var event = state ? 'FullscreenOn' : 'FullscreenOff';
if (event == 'FullscreenOn') {
}
else if (event == 'FullscreenOff') {
console.log($("#MainVideo").attr("src"));
var playVideo = videoNameArray[VideoPlaying -1];
console.log("playVideo:" + playVideo);
var mainvideo = document.getElementById("MainVideo");
mainvideo.pause();
mainvideo.currentTime = 0;
mainvideo.src= "";
}
});
会不会不支持浏览器的版本控制?还是我缺少允许视频在 IE 和 Edge 上播放的代码?