Skip to content

Commit

Permalink
fix: ensure we clear the cam url on collapse / destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Jan 22, 2021
1 parent 2f5886b commit e9dbd2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/components/cards/CollapsableCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ export default class ToolheadCard extends Vue {
}
mounted () {
this.$emit('collapsed', this.isCollapsed)
if (this.hasCollapseButtonSlot) {
this.collapsable = false
}
Expand Down
21 changes: 16 additions & 5 deletions src/components/cards/dashboard/CameraCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
:draggable="true"
:inLayout="inLayout"
:enabled="enabled"
@enabled="$emit('enabled', $event)">
@enabled="$emit('enabled', $event)"
@collapsed="onCollapse">

<img :src="cameraUrl" class="webcam" :style="cameraTransforms" v-if="streamType === 'mjpgstreamer'" />
<video :src="cameraUrl" autoplay class="webcam" :style="cameraTransforms" v-if="streamType === 'ipcamera'" />
Expand All @@ -27,12 +28,22 @@ export default class CameraCard extends Mixins(UtilsMixin) {
@Prop({ type: Boolean, default: true })
enabled!: boolean
get streamType () {
return this.$store.state.config.fileConfig.camera.type
cameraUrl = ''
beforeDestroy () {
this.cameraUrl = ''
}
get cameraUrl (): string {
return this.$store.state.config.fileConfig.camera.url
onCollapse (collapsed: boolean) {
if (collapsed) {
this.cameraUrl = ''
} else {
this.cameraUrl = this.$store.state.config.fileConfig.camera.url
}
}
get streamType () {
return this.$store.state.config.fileConfig.camera.type
}
get cameraTransforms () {
Expand Down

0 comments on commit e9dbd2f

Please sign in to comment.