<template>
  <div>
    <el-row>
      <el-col :span="6">
        <video-tree @click="handleCameraClicked"/>
      </el-col>

      <el-col :span="18">
        <web-play ref="webCtrl" />
      </el-col>
    </el-row>
  </div>
</template>

<script>
import VideoTree from './videoTree'
import WebPlay from './webPlay'

export default {
  name: 'VideoMonitor',
  components: { WebPlay, VideoTree },
  data() {
    return {

    }
  },
  mounted() {

  },
  activated() {

  },
  methods: {
    handleCameraClicked(camera) {
      console.log(camera)
      if (typeof camera.ip === 'undefined' || camera.ip === '') {
        console.log('ip is null')
        return false
      }
      if (typeof camera.username === 'undefined' || camera.username === '') {
        console.log('username is null')
        return false
      }
      if (typeof camera.password === 'undefined' || camera.password === '') {
        console.log('password is null')
        return false
      }

      // 开始预览
      this.$refs.webCtrl.$refs.play.contentWindow.startPlayReal(camera)
    }
  }
}
</script>

<style scoped>

</style>
