[Fix] Freetube does not play the next video in a playlist when using the Invidious API (#1488)
* fix playlists for invidious * Code clean up + bug fix Co-authored-by: Preston <freetubeapp@protonmail.com>
This commit is contained in:
parent
f801ea4b05
commit
27617ccc40
|
@ -190,14 +190,14 @@ export default Vue.extend({
|
|||
}
|
||||
} else {
|
||||
const videoIndex = this.playlistItems.findIndex((item) => {
|
||||
return item.id === this.videoId
|
||||
return (item.id ?? item.videoId) === this.videoId
|
||||
})
|
||||
|
||||
if (videoIndex === this.playlistItems.length - 1) {
|
||||
if (this.loopEnabled) {
|
||||
this.$router.push(
|
||||
{
|
||||
path: `/watch/${this.playlistItems[0].id}`,
|
||||
path: `/watch/${this.playlistItems[0].id ?? this.playlistItems[0].videoId}`,
|
||||
query: playlistInfo
|
||||
}
|
||||
)
|
||||
|
@ -211,7 +211,7 @@ export default Vue.extend({
|
|||
} else {
|
||||
this.$router.push(
|
||||
{
|
||||
path: `/watch/${this.playlistItems[videoIndex + 1].id}`,
|
||||
path: `/watch/${this.playlistItems[videoIndex + 1].id ?? this.playlistItems[videoIndex + 1].videoId}`,
|
||||
query: playlistInfo
|
||||
}
|
||||
)
|
||||
|
@ -253,20 +253,20 @@ export default Vue.extend({
|
|||
}
|
||||
} else {
|
||||
const videoIndex = this.playlistItems.findIndex((item) => {
|
||||
return item.id === this.videoId
|
||||
return (item.id ?? item.videoId) === this.videoId
|
||||
})
|
||||
|
||||
if (videoIndex === 0) {
|
||||
this.$router.push(
|
||||
{
|
||||
path: `/watch/${this.playlistItems[this.randomizedPlaylistItems.length - 1].id}`,
|
||||
path: `/watch/${this.playlistItems[this.randomizedPlaylistItems.length - 1].id ?? this.playlistItems[this.randomizedPlaylistItems.length - 1].videoId}`,
|
||||
query: playlistInfo
|
||||
}
|
||||
)
|
||||
} else {
|
||||
this.$router.push(
|
||||
{
|
||||
path: `/watch/${this.playlistItems[videoIndex - 1].id}`,
|
||||
path: `/watch/${this.playlistItems[videoIndex - 1].id ?? this.playlistItems[videoIndex - 1].videoId}`,
|
||||
query: playlistInfo
|
||||
}
|
||||
)
|
||||
|
@ -388,8 +388,8 @@ export default Vue.extend({
|
|||
this.playlistItems.forEach((item) => {
|
||||
const randomInt = Math.floor(Math.random() * remainingItems.length)
|
||||
|
||||
if (remainingItems[randomInt].id !== this.videoId) {
|
||||
items.push(remainingItems[randomInt].id)
|
||||
if ((remainingItems[randomInt].id ?? remainingItems[randomInt].videoId) !== this.videoId) {
|
||||
items.push(remainingItems[randomInt].id ?? remainingItems[randomInt].videoId)
|
||||
}
|
||||
|
||||
remainingItems.splice(randomInt, 1)
|
||||
|
|
Loading…
Reference in New Issue