mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
mute video if not focused
This commit is contained in:
parent
33384c0408
commit
fc43a0a3ab
@ -312,6 +312,10 @@
|
|||||||
this._video.addEventListener('canplaythrough', () => {
|
this._video.addEventListener('canplaythrough', () => {
|
||||||
this.$accessor.video.setPlayable(true)
|
this.$accessor.video.setPlayable(true)
|
||||||
if (this.autoplay) {
|
if (this.autoplay) {
|
||||||
|
if (!document.hasFocus()) {
|
||||||
|
this.$accessor.video.setMuted(true)
|
||||||
|
}
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$accessor.video.play()
|
this.$accessor.video.play()
|
||||||
})
|
})
|
||||||
|
@ -47,6 +47,11 @@ export const mutations = mutationTree(state, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setMuted(state, muted: boolean) {
|
||||||
|
state.muted = muted
|
||||||
|
set('mute', muted)
|
||||||
|
},
|
||||||
|
|
||||||
toggleMute(state) {
|
toggleMute(state) {
|
||||||
state.muted = !state.muted
|
state.muted = !state.muted
|
||||||
set('mute', state.muted)
|
set('mute', state.muted)
|
||||||
|
Loading…
Reference in New Issue
Block a user