Skip to content

Commit

Permalink
feat: restart stream if enableAudio changes
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Dec 9, 2023
1 parent 701fe6d commit 2b7bbc2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/webcams/streamers/WebrtcGo2rtc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class WebrtcGo2rtc extends Mixins(BaseMixin, WebcamMixin) {
// create media types array
const media = ['video']
if (this.camSettings.extra_data?.enableAudio ?? false) media.push('audio')
if (this.enableAudio) media.push('audio')
url.searchParams.set('media', media.join('+'))
// change protocol to ws
Expand All @@ -84,13 +84,24 @@ export default class WebrtcGo2rtc extends Mixins(BaseMixin, WebcamMixin) {
return this.convertUrl(url.toString(), this.printerUrl)
}
get enableAudio() {
return this.camSettings.extra_data?.enableAudio ?? false
}
// stop and restart the video if the url changes
@Watch('url')
changedUrl() {
this.terminate()
this.start()
}
// stop and restart the video if enableAudio changes
@Watch('enableAudio')
changedEnableAudio() {
this.terminate()
this.start()
}
get expanded(): boolean {
return this.$store.getters['gui/getPanelExpand']('webcam-panel', this.viewport) ?? false
}
Expand Down

0 comments on commit 2b7bbc2

Please sign in to comment.