From a26750aa2e5c6cffa3b1e12338efcdbcd680335f Mon Sep 17 00:00:00 2001 From: Svallinn <41585298+Svallinn@users.noreply.github.com> Date: Sat, 6 Mar 2021 20:09:13 +0000 Subject: [PATCH] Verify paused player before autoplaying next video (#1089) This prevents the autoplay from playing the next video if the current video gets manually replayed by the user --- src/renderer/views/Watch/Watch.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index aa014949..00745b4d 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -842,7 +842,10 @@ export default Vue.extend({ const nextVideoInterval = this.defaultInterval if (this.watchingPlaylist) { this.playNextTimeout = setTimeout(() => { - this.$refs.watchVideoPlaylist.playNextVideo() + const player = this.$refs.videoPlayer.player + if (player !== null && player.paused()) { + this.$refs.watchVideoPlaylist.playNextVideo() + } }, nextVideoInterval * 1000) this.showToast({ @@ -857,15 +860,18 @@ export default Vue.extend({ }) } else if (this.playNextVideo) { this.playNextTimeout = setTimeout(() => { - const nextVideoId = this.recommendedVideos[0].videoId - this.$router.push( - { - path: `/watch/${nextVideoId}` - } - ) - this.showToast({ - message: this.$t('Playing Next Video') - }) + const player = this.$refs.videoPlayer.player + if (player !== null && player.paused()) { + const nextVideoId = this.recommendedVideos[0].videoId + this.$router.push( + { + path: `/watch/${nextVideoId}` + } + ) + this.showToast({ + message: this.$t('Playing Next Video') + }) + } }, 5000) this.showToast({