diff --git a/client/src/components/video.vue b/client/src/components/video.vue index 65a847a..f50aa90 100644 --- a/client/src/components/video.vue +++ b/client/src/components/video.vue @@ -312,6 +312,10 @@ this._video.addEventListener('canplaythrough', () => { this.$accessor.video.setPlayable(true) if (this.autoplay) { + if (!document.hasFocus()) { + this.$accessor.video.setMuted(true) + } + this.$nextTick(() => { this.$accessor.video.play() }) diff --git a/client/src/store/video.ts b/client/src/store/video.ts index 45d7add..21c2883 100644 --- a/client/src/store/video.ts +++ b/client/src/store/video.ts @@ -47,6 +47,11 @@ export const mutations = mutationTree(state, { } }, + setMuted(state, muted: boolean) { + state.muted = muted + set('mute', muted) + }, + toggleMute(state) { state.muted = !state.muted set('mute', state.muted)