Skip to content

Commit

Permalink
add url param for audio volume.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Urbanek committed Mar 27, 2023
1 parent d08d3ec commit 98ba32c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@
shakeKbd = false
get volume() {
const numberParam = parseFloat(new URL(location.href).searchParams.get('volume') || '1.0')
return Math.max(0.0, Math.min(!isNaN(numberParam) ? numberParam * 100 : 100, 100))
}
get isCastMode() {
return !!new URL(location.href).searchParams.get('cast')
}
Expand All @@ -197,6 +202,11 @@
return this.isCastMode || this.isEmbedMode
}
@Watch('volume', { immediate: true })
onVolume(volume: number) {
this.$accessor.video.setVolume(volume)
}
@Watch('hideControls', { immediate: true })
onHideControls(enabled: boolean) {
if (enabled) {
Expand Down

0 comments on commit 98ba32c

Please sign in to comment.