<template>
<div class="video">
<el-row>
<el-col :span="6">
<video-tree @click="handleCameraClicked"/>
</el-col>
<el-col :span="18">
<div id="tabDiv">
<!--<el-tabs v-model="activeName" type="border-card" @tab-click.once ="handleClick">-->
<!--<el-tab-pane label="海康" name="hk">-->
<!--<iframe v-if="activeName === 'hk'" name="playHK" class="iframe-body" src="/static/webCtrl/hk/demo_embedded_for_iframe.html"/>-->
<iframe name="playHK" class="iframe-body" src="/static/webCtrl/hk/demo_embedded_for_iframe.html"/>
<!--</el-tab-pane>-->
<!--<el-tab-pane label="NVR" name="nvr">-->
<!--<iframe v-if="activeName==='nvr'" name="playNVR" class="iframe-body" src="/static/webCtrl/nvr/demo-easy.html"/>-->
<!--</el-tab-pane>-->
<!--</el-tabs>-->
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import VideoTree from './videoTree'
export default {
name: 'VideoMonitor',
components: { VideoTree },
data() {
return {
activeName: 'hk',
tabHeight: '',
tabWidth: ''
}
},
mounted() {
// console.log(document.getElementById("tabDiv").getBoundingClientRect().left)
setTimeout(() => {
window.frames['playHK'].initPlugin('real', document.getElementById('tabDiv').getBoundingClientRect().left + 20, 110)
}, 100)
},
methods: {
handleClick(tab, event) {
if (tab.name === 'hk') {
this.activeName = 'hk'
window.frames['playHK'].initPlugin('real', document.getElementById('tabDiv').getBoundingClientRect().left + 20)
} else if (tab.name === 'nvr') {
this.activeName = 'nvr'
window.frames['playNVR'].stopPlayReal(null)
}
},
handleCameraClicked(camera) {
console.log(camera)
if (typeof camera.indexCode === 'undefined' || camera.indexCode === '') {
console.log('monitorPoint is null')
return false
} else {
if (this.activeName === 'hk') {
window.frames['playHK'].play(camera.indexCode)
} else if (this.activeName === 'nvr') {
window.frames['playNVR'].startPlayReal()
}
}
}
}
}
</script>
<style scoped>
.iframe-body{
height: calc(100vh - 180px);
width: 100%;
position: relative;
top: 0px;
left: 0px;
/*frameBorder: 0;*/
scrolling: no;
border: 1px;
}
.video{
background: white;
}
</style>