[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 {
|
} else {
|
||||||
const videoIndex = this.playlistItems.findIndex((item) => {
|
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 (videoIndex === this.playlistItems.length - 1) {
|
||||||
if (this.loopEnabled) {
|
if (this.loopEnabled) {
|
||||||
this.$router.push(
|
this.$router.push(
|
||||||
{
|
{
|
||||||
path: `/watch/${this.playlistItems[0].id}`,
|
path: `/watch/${this.playlistItems[0].id ?? this.playlistItems[0].videoId}`,
|
||||||
query: playlistInfo
|
query: playlistInfo
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -211,7 +211,7 @@ export default Vue.extend({
|
||||||
} else {
|
} else {
|
||||||
this.$router.push(
|
this.$router.push(
|
||||||
{
|
{
|
||||||
path: `/watch/${this.playlistItems[videoIndex + 1].id}`,
|
path: `/watch/${this.playlistItems[videoIndex + 1].id ?? this.playlistItems[videoIndex + 1].videoId}`,
|
||||||
query: playlistInfo
|
query: playlistInfo
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -253,20 +253,20 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const videoIndex = this.playlistItems.findIndex((item) => {
|
const videoIndex = this.playlistItems.findIndex((item) => {
|
||||||
return item.id === this.videoId
|
return (item.id ?? item.videoId) === this.videoId
|
||||||
})
|
})
|
||||||
|
|
||||||
if (videoIndex === 0) {
|
if (videoIndex === 0) {
|
||||||
this.$router.push(
|
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
|
query: playlistInfo
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
this.$router.push(
|
this.$router.push(
|
||||||
{
|
{
|
||||||
path: `/watch/${this.playlistItems[videoIndex - 1].id}`,
|
path: `/watch/${this.playlistItems[videoIndex - 1].id ?? this.playlistItems[videoIndex - 1].videoId}`,
|
||||||
query: playlistInfo
|
query: playlistInfo
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -388,8 +388,8 @@ export default Vue.extend({
|
||||||
this.playlistItems.forEach((item) => {
|
this.playlistItems.forEach((item) => {
|
||||||
const randomInt = Math.floor(Math.random() * remainingItems.length)
|
const randomInt = Math.floor(Math.random() * remainingItems.length)
|
||||||
|
|
||||||
if (remainingItems[randomInt].id !== this.videoId) {
|
if ((remainingItems[randomInt].id ?? remainingItems[randomInt].videoId) !== this.videoId) {
|
||||||
items.push(remainingItems[randomInt].id)
|
items.push(remainingItems[randomInt].id ?? remainingItems[randomInt].videoId)
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingItems.splice(randomInt, 1)
|
remainingItems.splice(randomInt, 1)
|
||||||
|
|
Loading…
Reference in New Issue