diff options
| author | Hellyson Rodrigo Parteka <[email protected]> | 2021-11-17 20:17:08 -0300 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2021-11-20 19:01:52 -0500 |
| commit | 46701a8aab0247943defc3b09c719a61cb5df2b0 (patch) | |
| tree | f0f277653172367cc8af285bbe1ac9ae20833ad0 /src | |
| parent | 5cc74a3d51adf75db44d7102734ba5f95429be24 (diff) | |
| download | muse-46701a8aab0247943defc3b09c719a61cb5df2b0.tar.xz muse-46701a8aab0247943defc3b09c719a61cb5df2b0.zip | |
fix: change `player.add(...)` behavior
Diffstat (limited to 'src')
| -rw-r--r-- | src/services/player.ts | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/services/player.ts b/src/services/player.ts index 9faef18..0446fa8 100644 --- a/src/services/player.ts +++ b/src/services/player.ts @@ -241,25 +241,12 @@ export default class { } add(song: QueuedSong, {immediate = false} = {}): void { - if (song.playlist) { + if (song.playlist || !immediate) { // Add to end of queue this.queue.push(song); } else { - // Not from playlist, add immediately - let insertAt = this.queuePosition + 1; - - if (!immediate) { - // Loop until playlist song - this.queue.some(song => { - if (song.playlist) { - return true; - } - - insertAt++; - return false; - }); - } - + // Add as the next song to be played + const insertAt = this.queuePosition + 1; this.queue = [...this.queue.slice(0, insertAt), song, ...this.queue.slice(insertAt)]; } } |
