|
|
|
|
@ -3,6 +3,12 @@
|
|
|
|
|
|
|
|
|
|
<a-button type="primary" @click="full" v-if="!isFullscreen"> 全屏<a-icon type="right" /> </a-button>
|
|
|
|
|
<a-button type="primary" @click="full" v-if="isFullscreen"><a-icon type="left" /> 退出全屏 </a-button>
|
|
|
|
|
<!-- @change="tabsChange" v-model="tabKey"-->
|
|
|
|
|
<a-tabs v-model="activeKey" slot="headerContent" @change="tabChange" v-if="areas" padding:10px>
|
|
|
|
|
<a-tab-pane :key="item.toString()" :tab="item" v-for="item in areas">
|
|
|
|
|
|
|
|
|
|
</a-tab-pane>
|
|
|
|
|
</a-tabs>
|
|
|
|
|
<a-row v-for='rowIndex in row' :key='rowIndex'>
|
|
|
|
|
<a-col v-for='colIndex in column' :key='colIndex' :span="24/column" :style="{height: videoHeight}" >
|
|
|
|
|
<video class="camera" :id="rowIndex+'-'+colIndex" autoplay muted :style="{'height': '100%',width:'100%','object-fit':'fill'}" ></video>
|
|
|
|
|
@ -35,7 +41,9 @@ export default {
|
|
|
|
|
isFullscreen: false,
|
|
|
|
|
originHeight: 0,
|
|
|
|
|
fullHeight: 0,
|
|
|
|
|
players: []
|
|
|
|
|
players: [],
|
|
|
|
|
areas:[],
|
|
|
|
|
activeKey: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//watch: {},
|
|
|
|
|
@ -51,7 +59,8 @@ export default {
|
|
|
|
|
this.getWallStyle();
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.getAllCameras()
|
|
|
|
|
|
|
|
|
|
this.getAllAreas()
|
|
|
|
|
});
|
|
|
|
|
let isFullscreen =
|
|
|
|
|
document.fullscreenElement ||
|
|
|
|
|
@ -124,13 +133,62 @@ export default {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getAllAreas(){
|
|
|
|
|
this.$api.httpApi.getAllAreas({
|
|
|
|
|
data: {}
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if(res.code == 200) {
|
|
|
|
|
this.areas = res.data;
|
|
|
|
|
|
|
|
|
|
if(this.areas.length == 0){
|
|
|
|
|
this.getAllCameras()
|
|
|
|
|
}else{
|
|
|
|
|
this.activeKey = this.areas[0]
|
|
|
|
|
this.tabChange();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
destory(){
|
|
|
|
|
for(let player of this.players){
|
|
|
|
|
console.log("stop")
|
|
|
|
|
player.destroy()
|
|
|
|
|
}
|
|
|
|
|
this.players = []
|
|
|
|
|
},
|
|
|
|
|
tabChange(){
|
|
|
|
|
this.destory();
|
|
|
|
|
this.$api.httpApi.allCamerasByArea({
|
|
|
|
|
params:{
|
|
|
|
|
area:this.activeKey
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if(res.code == 200) {
|
|
|
|
|
let cameras = res.data;
|
|
|
|
|
for(let i = 1;i<=cameras.length;i++){
|
|
|
|
|
let rowIndex = Math.floor((i-1) / this.column) + 1;
|
|
|
|
|
if(rowIndex > this.row){
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
let columnIndex = i % this.column;
|
|
|
|
|
if(columnIndex == 0){
|
|
|
|
|
columnIndex = this.column;
|
|
|
|
|
}
|
|
|
|
|
let idName = rowIndex + "-" + columnIndex;
|
|
|
|
|
console.log("idName:"+idName);
|
|
|
|
|
let server = cameras[i-1].rtcServer+":"+ cameras[i-1].rtcServerPort
|
|
|
|
|
let video = document.getElementById(idName);
|
|
|
|
|
let player = new WebRtcPlayer(server,video,"camera"+cameras[i-1].id);
|
|
|
|
|
this.players.push(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
full () {
|
|
|
|
|
if(this.isFullscreen){
|
|
|
|
|
this.exitfullscreen()
|
|
|
|
|
|