ix autoplay unmute.
This commit is contained in:
parent
bb308f8bcc
commit
368e4d7f7c
@ -339,10 +339,13 @@
|
|||||||
|
|
||||||
@Watch('muted')
|
@Watch('muted')
|
||||||
onMutedChanged(muted: boolean) {
|
onMutedChanged(muted: boolean) {
|
||||||
if (this._video) {
|
if (this._video && this._video.muted != muted) {
|
||||||
this._video.muted = muted
|
this._video.muted = muted
|
||||||
this.startsMuted = muted
|
this.startsMuted = muted
|
||||||
if (!muted) this.mutedOverlay = false
|
}
|
||||||
|
|
||||||
|
if (!muted) {
|
||||||
|
this.mutedOverlay = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,9 +395,9 @@
|
|||||||
this._video.addEventListener('canplaythrough', () => {
|
this._video.addEventListener('canplaythrough', () => {
|
||||||
this.$accessor.video.setPlayable(true)
|
this.$accessor.video.setPlayable(true)
|
||||||
if (this.autoplay) {
|
if (this.autoplay) {
|
||||||
|
// start as muted due to restrictive browsers autoplay policy
|
||||||
if (this.startsMuted && (!document.hasFocus() || !this.$accessor.active)) {
|
if (this.startsMuted && (!document.hasFocus() || !this.$accessor.active)) {
|
||||||
this.$accessor.video.setMuted(true)
|
this.$accessor.video.setMuted(true)
|
||||||
this._video.muted = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -29,15 +29,6 @@ new Vue({
|
|||||||
store,
|
store,
|
||||||
render: (h) => h(app),
|
render: (h) => h(app),
|
||||||
created() {
|
created() {
|
||||||
const click = () => {
|
|
||||||
this.$accessor.setActive()
|
|
||||||
if (this.$accessor.settings.autoplay && this.$accessor.video.playing) {
|
|
||||||
this.$accessor.video.setMuted(false)
|
|
||||||
}
|
|
||||||
window.removeEventListener('click', click, false)
|
|
||||||
}
|
|
||||||
window.addEventListener('click', click, false)
|
|
||||||
|
|
||||||
this.$client.init(this)
|
this.$client.init(this)
|
||||||
this.$accessor.initialise()
|
this.$accessor.initialise()
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user