Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update watch page to stop at end of playlist (when loop disabled) without countdown #3362

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,34 @@ export default defineComponent({

playlistVideoCount: function () {
return this.playlistItems.length
}
},

shouldStopDueToPlaylistEnd: function () {
if (!this.videoIsLastInInPlaylistItems) { return false }

// Loop enabled = should not stop
return !this.loopEnabled
},

videoIsLastInInPlaylistItems: function() {
if (this.shuffleEnabled) {
return this.videoIndexInPlaylistItems === this.randomizedPlaylistItems.length - 1
} else {
return this.videoIndexInPlaylistItems === this.playlistItems.length - 1
}
},

videoIndexInPlaylistItems: function () {
if (this.shuffleEnabled) {
return this.randomizedPlaylistItems.findIndex((item) => {
return item === this.videoId
})
} else {
return this.playlistItems.findIndex((item) => {
return (item.id ?? item.videoId) === this.videoId
})
}
},
},
watch: {
videoId: function (newId, oldId) {
Expand Down Expand Up @@ -182,8 +209,9 @@ export default defineComponent({
}
)
showToast(this.$t('Playing Next Video'))
} else {
showToast(this.$t('The playlist has ended. Enable loop to continue playing'))
}
showToast(this.$t('The playlist has ended. Enable loop to continue playing'))
} else {
this.$router.push(
{
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,11 @@ export default defineComponent({
return
}

if (this.watchingPlaylist && this.$refs.watchVideoPlaylist.shouldStopDueToPlaylistEnd) {
// Let `watchVideoPlaylist` handle end of playlist, no countdown needed
this.$refs.watchVideoPlaylist.playNextVideo()
return
}
const nextVideoInterval = this.defaultInterval
this.playNextTimeout = setTimeout(() => {
const player = this.$refs.videoPlayer.player
Expand Down