video标签的视频全屏
按钮:
<div class="fullScreen" @click="fullScreen"><i class="el-icon-full-screen"></i></div>
视频标签
<video id="video" width="100%" height="100%" autoplay="autoplay" muted>
<source :src="videoUrl" type="video/mp4" />
</video>
js部分:
// 全屏
Screen (element) {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
} else if (element.oRequestFullscreen) {
element.oRequestFullscreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullScreen();
} else {
var docHtml = document.documentElement;
var docBody = document.body;
var videobox = document.getElementById(‘video‘);
var cssText = ‘width:100%;height:100%;overflow:hidden;‘;
docHtml.style.cssText = cssText;
docBody.style.cssText = cssText;
videobox.style.cssText = cssText+‘;‘+‘margin:0px;padding:0px;‘;
document.IsFullScreen = true;
}
},
fullScreen () {
let element = document.getElementById(‘video‘)
this.Screen(element)
},
然后退出其实直接按ESC就可以了
相关推荐
wikiwater 2020-10-27
IdeaElements 2020-08-19
Sophiego 2020-08-16
Kakoola 2020-08-01
Kakoola 2020-07-29
ELEMENTS爱乐冬雨 2020-07-18
ELEMENTS爱乐小超 2020-07-04
ELEMENTS爱乐小超 2020-07-04
Kakoola 2020-06-28
Feastaw 2020-06-18
Wmeng0 2020-06-14
ELEMENTS爱乐冬雨 2020-06-14
云之高水之远 2020-06-14
哈喽elements 2020-06-14
Feastaw 2020-06-11