yingshiVideo.vue
3.16 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<template>
<div class="videoBox">
<div id="canvasVideo" style="background: black;width:100%;height:100%"></div>
<div class="btns" v-if="decoder">
<el-button type="text" class="scaleBtn" icon="el-icon-plus" @mousedown.native='setControl(8)' @mouseup.native='stopControl(8)'></el-button>
<el-button type="text" class="scaleBtn" icon="el-icon-minus" @mousedown.native='setControl(9)' @mouseup.native='stopControl(9)'></el-button>
</div>
</div>
</template>
<script>
export default{
data(){
return{
currobj:{},
decoder:'',
isEdit:'add'
}
},
methods:{
dialogInit(url,atoken,isEdit,obj,width,height,dIndex){
this.currobj = obj;
this.isEdit = isEdit;
this.dIndex = dIndex
this.playerVideo(url,atoken,width,height)
},
playerVideo(url,atoken,width,height){
if(this.decoder){
let canvasVideo = document.getElementById('canvasVideo')
canvasVideo.innerHTML = ''
}
this.$nextTick(()=>{
this.decoder = new EZUIKit.EZUIKitPlayer({
id: "canvasVideo", // 视频容器ID
accessToken: atoken,
url: url,
template: 'theme',//simple - 极简版;standard-标准版;security - 安防版(预览回放);voice-语音版;
autoplay: true,
// footer: ['paly','hd','fullScreen','pantile'],
width: width?width:800,
height:height?height:500,
});
setTimeout(()=>{
this.decoder.play();
},1000)
if(this.isEdit == 'edit'){
let moveParmas = {
'platform':this.currobj.platform,
'deviceSerial':this.currobj.deviceSerial,
'channelNo':this.currobj.channelNo,
'index':this.dIndex
}
this.$api.videoShopTourReport.getPresetMove(moveParmas).then(data => {
console.log(data.data)
})
}
})
},
setControl(val){
let parmas = {
'platform':this.currobj.platform,
'deviceSerial':this.currobj.deviceSerial,
'channelNo':this.currobj.channelNo,
'direction':val,
'speed':1
}
this.$api.videoShopTourReport.ptzStart(parmas).then(data => {
let result = data.data
if(result.code !=200){
this.$message({
message: result.msg,
type: 'error'
});
}
})
},
stopControl(val){
let parmas = {
'platform':this.currobj.platform,
'deviceSerial':this.currobj.deviceSerial,
'channelNo':this.currobj.channelNo,
'direction':val
}
this.$api.videoShopTourReport.ptzStop(parmas).then(data => {
console.log(data)
})
},
}
}
</script>
<style scoped="scoped" lang="less">
.videoBox{
position: relative;
}
.btns{
position: absolute;
right: 15px;
bottom: 70px;
.scaleBtn{
padding: 0;
width: 20px;
height: 20px;
display: block;
background-color: #fff;
color: #000;
margin: 0 0 10px 0;
}
}
</style>