From 6bc482af9ef8fa040aa27522dc4cf5aac8209980 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 23 May 2022 21:18:20 +0100 Subject: [PATCH] Fix player destroying activated function. --- src/components/VideoPlayer.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/VideoPlayer.vue b/src/components/VideoPlayer.vue index 7f1cb7fc..6051fd71 100644 --- a/src/components/VideoPlayer.vue +++ b/src/components/VideoPlayer.vue @@ -74,11 +74,12 @@ export default { }, }, mounted() { - if (!this.shaka) this.shakaPromise = shaka.then(shaka => shaka.default).then(shaka => (this.shaka = shaka)); + if (!this.$shaka) this.shakaPromise = shaka.then(shaka => shaka.default).then(shaka => (this.$shaka = shaka)); if (!this.$hotkeys) this.hotkeysPromise = hotkeys.then(mod => mod.default).then(hotkeys => (this.$hotkeys = hotkeys)); }, activated() { + this.destroying = false; this.hotkeysPromise.then(() => { var self = this; this.$hotkeys( @@ -296,9 +297,9 @@ export default { if (noPrevPlayer) this.shakaPromise.then(() => { if (this.destroying) return; - this.shaka.polyfill.installAll(); + this.$shaka.polyfill.installAll(); - const localPlayer = new this.shaka.Player(videoEl); + const localPlayer = new this.$shaka.Player(videoEl); const proxyURL = new URL(component.video.proxyUrl); let proxyPath = proxyURL.pathname; if (proxyPath.lastIndexOf("/") === proxyPath.length - 1) { @@ -334,9 +335,9 @@ export default { Math.max(this.getPreferenceNumber("bufferGoal", 10), 10), ); - this.setPlayerAttrs(localPlayer, videoEl, uri, mime, this.shaka); + this.setPlayerAttrs(localPlayer, videoEl, uri, mime, this.$shaka); }); - else this.setPlayerAttrs(this.$player, videoEl, uri, mime, this.shaka); + else this.setPlayerAttrs(this.$player, videoEl, uri, mime, this.$shaka); if (noPrevPlayer) { videoEl.addEventListener("timeupdate", () => {