mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-12 21:05:29 +01:00
fix: change player.add(...)
behavior
This commit is contained in:
parent
5cc74a3d51
commit
46701a8aab
|
@ -241,25 +241,12 @@ export default class {
|
||||||
}
|
}
|
||||||
|
|
||||||
add(song: QueuedSong, {immediate = false} = {}): void {
|
add(song: QueuedSong, {immediate = false} = {}): void {
|
||||||
if (song.playlist) {
|
if (song.playlist || !immediate) {
|
||||||
// Add to end of queue
|
// Add to end of queue
|
||||||
this.queue.push(song);
|
this.queue.push(song);
|
||||||
} else {
|
} else {
|
||||||
// Not from playlist, add immediately
|
// Add as the next song to be played
|
||||||
let insertAt = this.queuePosition + 1;
|
const insertAt = this.queuePosition + 1;
|
||||||
|
|
||||||
if (!immediate) {
|
|
||||||
// Loop until playlist song
|
|
||||||
this.queue.some(song => {
|
|
||||||
if (song.playlist) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
insertAt++;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.queue = [...this.queue.slice(0, insertAt), song, ...this.queue.slice(insertAt)];
|
this.queue = [...this.queue.slice(0, insertAt), song, ...this.queue.slice(insertAt)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue