Skip to content

Commit

Permalink
fix: fix img size without a stream (u4vl-mode) (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored May 29, 2022
1 parent 4be40b6 commit 4671935
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/webcams/Mjpegstreamer.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style>
<style scoped>
.webcamImage {
width: 100%;
background: lightgray;
Expand Down
10 changes: 7 additions & 3 deletions src/components/webcams/Uv4lMjpeg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
<img
ref="webcamUv4lMjpegImage"
v-observe-visibility="viewportVisibilityChanged"
:src="url"
:alt="camSettings.name"
:style="webcamStyle"
class="webcamImage"
@load="onload" />
</template>

<script lang="ts">
import { Component, Mixins, Prop } from 'vue-property-decorator'
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types'
Expand Down Expand Up @@ -109,5 +107,11 @@ export default class Uv4lMjpeg extends Mixins(BaseMixin) {
this.$refs.webcamUv4lMjpegImage.naturalWidth / this.$refs.webcamUv4lMjpegImage.naturalHeight
}
}
@Watch('url')
async urlChanged() {
await this.stopStream()
await this.startStream()
}
}
</script>

0 comments on commit 4671935

Please sign in to comment.