Archived
2
0

add url param for audio volume.

This commit is contained in:
Pawel Urbanek 2023-03-27 12:53:39 +02:00
parent d08d3eccef
commit 98ba32c574

View File

@ -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')
}
@ -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) {