|
|
@@ -1,72 +1,96 @@
|
|
|
<template>
|
|
|
<box
|
|
|
componentkey="LEDCamera"
|
|
|
- title="LED屏画面监测"
|
|
|
+ title="LED屏画面监测摄像头"
|
|
|
+ :bus="bus"
|
|
|
>
|
|
|
- <camera-player
|
|
|
- :key="item.identifier"
|
|
|
- :class="{ 'u-pointer': canClick && item.onlineStatus }"
|
|
|
- :camera="item"
|
|
|
- @click.native="onClick"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="o-video-footer l-flex--row"
|
|
|
- @click.stop
|
|
|
- >
|
|
|
- <!-- <div class="l-flex__auto c-sibling-item u-ellipsis">
|
|
|
- {{ item.name }}
|
|
|
- </div> -->
|
|
|
- </div> </camera-player></box>
|
|
|
+ <video
|
|
|
+ ref="video"
|
|
|
+ style="width: 100%; height: 100%"
|
|
|
+ :src="src"
|
|
|
+ autoplay
|
|
|
+ muted
|
|
|
+ loop
|
|
|
+ @timeupdate="timeupdate"
|
|
|
+ @canplay="canplay"
|
|
|
+ />
|
|
|
+ </box>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import CameraPlayer from '@/components/external/camera/CameraPlayer'
|
|
|
-import { getCameras } from '@/api/external'
|
|
|
+import { getAssetUrl } from '@/api/asset'
|
|
|
import Box from './Box'
|
|
|
+import Bus from './bus'
|
|
|
export default {
|
|
|
components: {
|
|
|
- Box,
|
|
|
- CameraPlayer
|
|
|
+ Box
|
|
|
},
|
|
|
props: {
|
|
|
- device: {
|
|
|
- type: Object,
|
|
|
- required: true
|
|
|
+ full: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ currentTime: {
|
|
|
+ type: Number,
|
|
|
+ default: 0
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- cameraType: 2,
|
|
|
- item: {},
|
|
|
- canClick: false
|
|
|
+ nodata: false,
|
|
|
+ propCurrentTime: 0,
|
|
|
+ bus: {},
|
|
|
+ src:
|
|
|
+ process.env.ENV === 'xuzhou'
|
|
|
+ ? getAssetUrl('material-draft/aff61eb0-3531-409b-80a2-b3f1354b56e4')
|
|
|
+ : 'https://msr.rondochina.com:6443/oss-api/material-draft/aff61eb0-3531-409b-80a2-b3f1354b56e4'
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
- this.getCameras()
|
|
|
+ if (!this.full) {
|
|
|
+ Bus.$on('getCurrentTime', currentTime => {
|
|
|
+ const video = this.$refs.video
|
|
|
+ video.currentTime = currentTime
|
|
|
+ video.play()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ beforeDestroy () {
|
|
|
+ if (this.full) {
|
|
|
+ const video = this.$refs.video
|
|
|
+ Bus.$emit('getCurrentTime', video.currentTime)
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
- getCameras () {
|
|
|
- const key = Date.now()
|
|
|
- this.$key = key
|
|
|
- getCameras({
|
|
|
- deviceId: this.device.id,
|
|
|
- cameraType: this.cameraType
|
|
|
- })
|
|
|
- .then(({ data }) => {
|
|
|
- if (!data.length) { return }
|
|
|
- if (key === this.$key) {
|
|
|
- data = data.map(({ thirdPartyDevice }) => thirdPartyDevice)
|
|
|
- }
|
|
|
- this.item = data[0]// 取一个
|
|
|
- console.log(this.item)
|
|
|
- })
|
|
|
+ pause () {
|
|
|
+ const video = this.$refs.video
|
|
|
+ video.pause()
|
|
|
+ },
|
|
|
+ init () {
|
|
|
+ if (this.$init) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ console.log('init', this.currentTime)
|
|
|
+ const video = this.$refs.video
|
|
|
+ video.currentTime = this.currentTime
|
|
|
+ this.$init = true
|
|
|
+ },
|
|
|
+ timeupdate () {
|
|
|
+ const video = this.$refs.video
|
|
|
+ if (!video) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.bus = { currentTime: video.currentTime }
|
|
|
},
|
|
|
- onClick () {
|
|
|
- if (!this.canClick) { return }
|
|
|
- console.log('click')
|
|
|
+ canplay () {
|
|
|
+ console.log('canplay', this.full)
|
|
|
+ if (this.full) {
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style></style>
|
|
|
+<style lang="scss" scoped></style>
|