Add Next and Previous buttons to playlist in watch page

This commit is contained in:
Preston 2020-06-03 21:33:47 -04:00
parent 28e436db72
commit 275b6a0c12
2 changed files with 47 additions and 0 deletions

View File

@ -177,6 +177,43 @@ export default Vue.extend({
}
},
playPreviousVideo: function () {
const playlistInfo = {
playlistId: this.playlistId
}
const watchedIndex = this.playlistItems.findIndex((watchedVideo) => {
return watchedVideo.videoId === this.videoId
})
if (this.shuffleEnabled && this.playlistWatchedVideoList.length > 1) {
this.playlistWatchedVideoList.pop()
const lastVideo = this.playlistWatchedVideoList.pop()
this.$router.push(
{
path: `/watch/${lastVideo}`,
query: playlistInfo
}
)
} else if (watchedIndex === 0) {
const videoId = this.playlistItems[this.playlistItems.length - 1].videoId
this.$router.push(
{
path: `/watch/${videoId}`,
query: playlistInfo
}
)
} else {
const videoId = this.playlistItems[watchedIndex - 1].videoId
this.$router.push(
{
path: `/watch/${videoId}`,
query: playlistInfo
}
)
}
},
getPlaylistInformationLocal: function () {
this.isLoading = true

View File

@ -36,6 +36,16 @@
icon="random"
@click="toggleShuffle"
/>
<font-awesome-icon
class="playlistIcon"
icon="step-backward"
@click="playPreviousVideo"
/>
<font-awesome-icon
class="playlistIcon"
icon="step-forward"
@click="playNextVideo"
/>
</p>
<ft-flex-box
v-if="!isLoading"