fix playback of library songs on shuffle

This commit is contained in:
vapormusic 2022-01-23 23:45:01 +07:00
parent 25f53f9b72
commit 0bbf4ee4b3

View file

@ -2514,24 +2514,30 @@ const app = new Vue({
app.mk.stop().then(() => {
this.mk.clearQueue().then(function(_) {
if (item) {
app.mk.setQueue({
[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id
}).then(function () {
app.mk.play().then(() => {
if (app.mk.shuffleMode == 1) {
shuffleArray(query)
}
app.mk.queue.append(query)
})
})
} else {
this.mk.clearQueue().then(function (_) {
if (app.mk.shuffleMode == 1) {
shuffleArray(query)
}
app.mk.queue.append(query)
if (childIndex != -1) {
app.mk.changeToMediaAtIndex(childIndex)
} else if (item) {
app.mk.playNext({
[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id
}).then(function() {
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1)
app.mk.play()
})
} else {
app.mk.play()
}
})
}
})
} else {
app.mk.stop().then(() => {