|
|
@@ -1,33 +1,26 @@
|
|
|
<template>
|
|
|
- <div
|
|
|
- class="o-video controls"
|
|
|
- :class="{mask: paused || loading}"
|
|
|
- >
|
|
|
+ <div class="o-video controls">
|
|
|
<video
|
|
|
ref="video"
|
|
|
- class="o-video__player o-simple-video"
|
|
|
- muted
|
|
|
+ class="o-video__player"
|
|
|
:src="assetUrl"
|
|
|
+ muted
|
|
|
+ controls
|
|
|
+ controlslist="nodownload noremoteplayback"
|
|
|
/>
|
|
|
- <div
|
|
|
- class="o-video__mask"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="l-flex--row center o-video__btn u-pointer"
|
|
|
- @click.stop="onPlayOrPause"
|
|
|
- >
|
|
|
- <i :class="statusIconClass" />
|
|
|
+ <template v-if="camera.status !== 1">
|
|
|
+ <div class="o-video__mask">
|
|
|
+ <div
|
|
|
+ class="l-flex--row center o-video__btn u-pointer"
|
|
|
+ @click.stop="onPlayOrPause"
|
|
|
+ >
|
|
|
+ <i :class="statusIconClass" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="l-flex--row c-footer"
|
|
|
- >
|
|
|
+ </template>
|
|
|
+ <div class="l-flex--row c-top">
|
|
|
<div class="l-flex__auto c-sibling-item u-ellipsis">{{ camera.startTime }}</div>
|
|
|
<slot />
|
|
|
- <i
|
|
|
- class="c-sibling-item el-icon-full-screen has-active"
|
|
|
- @click="onFullScreen"
|
|
|
- />
|
|
|
<i
|
|
|
class="c-sibling-item el-icon-delete has-active"
|
|
|
@click="onDeleteRecord"
|
|
|
@@ -61,11 +54,11 @@ export default {
|
|
|
statusIconClass () {
|
|
|
switch (true) {
|
|
|
case this.camera.status === 0:
|
|
|
- return 'el-icon-loading'
|
|
|
- case this.loading:
|
|
|
- return 'el-icon-loading'
|
|
|
+ return 'el-icon-download'
|
|
|
case this.isdownload:
|
|
|
return 'el-icon-download has-active'
|
|
|
+ case this.loading:
|
|
|
+ return 'el-icon-loading'
|
|
|
case this.paused:
|
|
|
return 'el-icon-video-play has-active'
|
|
|
default:
|
|
|
@@ -79,26 +72,14 @@ export default {
|
|
|
watch: {
|
|
|
camera (newValue, oldValue) {
|
|
|
this.paused = newValue.id === oldValue.id ? this.paused : true
|
|
|
+ this.isdownload = (this.camera.status !== 1 && this.camera.status !== 0)
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
- this.isdownload = !this.camera.url
|
|
|
if (this.camera.status === 0) {
|
|
|
this.loading = true
|
|
|
}
|
|
|
},
|
|
|
- mounted () {
|
|
|
- this.$refs.video.addEventListener('ended', () => {
|
|
|
- this.paused = true
|
|
|
- })
|
|
|
- this.$refs.video.addEventListener('waiting', () => {
|
|
|
- this.loading = true
|
|
|
- })
|
|
|
- this.$refs.video.addEventListener('playing', () => {
|
|
|
- this.loading = false
|
|
|
- this.paused = false
|
|
|
- })
|
|
|
- },
|
|
|
methods: {
|
|
|
onDeleteRecord () {
|
|
|
deleteRecord(this.camera.id).then(() => {
|
|
|
@@ -106,18 +87,8 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
onPlayOrPause () {
|
|
|
- switch (true) {
|
|
|
- case this.isdownload:
|
|
|
- this.$emit('onResumeDownloadRecord', this.camera.id)
|
|
|
- break
|
|
|
- case this.paused:
|
|
|
- this.paused = false
|
|
|
- this.$refs.video.play()
|
|
|
- break
|
|
|
- default:
|
|
|
- this.paused = true
|
|
|
- this.$refs.video.pause()
|
|
|
- break
|
|
|
+ if (this.isdownload) {
|
|
|
+ this.$emit('onResumeDownloadRecord', this.camera.id)
|
|
|
}
|
|
|
},
|
|
|
onFullScreen () {
|
|
|
@@ -160,12 +131,34 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.c-camera__checkbox{
|
|
|
+.c-camera__checkbox {
|
|
|
position: absolute;
|
|
|
top: 10px;
|
|
|
left: 10px;
|
|
|
}
|
|
|
-.mask .o-video__mask{
|
|
|
+
|
|
|
+.c-top {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ padding: 16px 16px 16px;
|
|
|
+ color: #fff;
|
|
|
+}
|
|
|
+
|
|
|
+.o-video__mask {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
+
|
|
|
+.o-video__btn {
|
|
|
+ font-size: 30px;
|
|
|
+}
|
|
|
+
|
|
|
+.o-video__player {
|
|
|
+ object-fit: contain;
|
|
|
+
|
|
|
+ &::-webkit-media-controls-volume-control-container {
|
|
|
+ display: none !important;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|