Fix player destroying activated function.

This commit is contained in:
Kavin 2022-05-23 21:18:20 +01:00
parent 686d5fd824
commit 6bc482af9e
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD

View File

@ -74,11 +74,12 @@ export default {
}, },
}, },
mounted() { 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) if (!this.$hotkeys)
this.hotkeysPromise = hotkeys.then(mod => mod.default).then(hotkeys => (this.$hotkeys = hotkeys)); this.hotkeysPromise = hotkeys.then(mod => mod.default).then(hotkeys => (this.$hotkeys = hotkeys));
}, },
activated() { activated() {
this.destroying = false;
this.hotkeysPromise.then(() => { this.hotkeysPromise.then(() => {
var self = this; var self = this;
this.$hotkeys( this.$hotkeys(
@ -296,9 +297,9 @@ export default {
if (noPrevPlayer) if (noPrevPlayer)
this.shakaPromise.then(() => { this.shakaPromise.then(() => {
if (this.destroying) return; 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); const proxyURL = new URL(component.video.proxyUrl);
let proxyPath = proxyURL.pathname; let proxyPath = proxyURL.pathname;
if (proxyPath.lastIndexOf("/") === proxyPath.length - 1) { if (proxyPath.lastIndexOf("/") === proxyPath.length - 1) {
@ -334,9 +335,9 @@ export default {
Math.max(this.getPreferenceNumber("bufferGoal", 10), 10), 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) { if (noPrevPlayer) {
videoEl.addEventListener("timeupdate", () => { videoEl.addEventListener("timeupdate", () => {