From b9f401cd3921980810b14fed8b51e1d28fe69ab8 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 21 Jul 2021 03:18:35 +0530 Subject: [PATCH] active check for when promise finishes. Closes #290 --- src/components/WatchVideo.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index ac475de5..650fce65 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -143,21 +143,24 @@ export default { comments: null, subscribed: false, channelId: null, + active: true, }; }, mounted() { this.getVideoData().then(() => { - this.$refs.videoPlayer.loadVideo(); + if (this.active) this.$refs.videoPlayer.loadVideo(); }); this.getSponsors(); if (this.getPreferenceBoolean("comments", true)) this.getComments(); }, activated() { + this.active = true; this.selectedAutoPlay = this.getPreferenceBoolean("autoplay", true); if (this.video.duration) this.$refs.videoPlayer.loadVideo(); window.addEventListener("scroll", this.handleScroll); }, deactivated() { + this.active = false; window.removeEventListener("scroll", this.handleScroll); }, watch: {