video.vue
1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
<div class="video-box">
<el-dialog title="录像" :visible.sync="videoDialogVisible">
<video id="playerVideo" class="dom-video" controls muted></video>
<div slot="footer" class="player-footer">
<button @click="closeVideoDialog">关闭</button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data () {
return {
videoDialogVisible: false,
domTimer: null,
player: ''
}
},
methods: {
playvideos: function (play_url) {
let _this = this;
this.videoDialogVisible = true;
this.domTimer = setTimeout(() => {
_this.player = document.getElementById('playerVideo');
console.log(this.player)
_this.player.loop = true;
_this.player.src = play_url;
_this.player.play();
}, 100);
},
closeVideoDialog: function () {
this.domTimer = null;
this.player.src = '';
this.player = '';
this.videoDialogVisible = false;
}
}
}
</script>
<style scoped>
.dom-video {
width: 100%;
height: 100%;
border-radius: 5px;
}
.player-footer button {
padding: 0 2%;
}
</style>