video.vue
1.71 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
54
55
56
57
58
59
<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>
// import {config} from '../../public/js/config'
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;
if(window.config.https) {
let loc = location.host
this.player.src = `https://${loc}/${play_url.split(":20070")[1]}`
} else {
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>