aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorHellyson Rodrigo Parteka <[email protected]>2021-11-17 20:17:08 -0300
committerHellyson Rodrigo Parteka <[email protected]>2021-11-17 20:17:08 -0300
commitc16449b08f088f35d06196c527f69b70405e7394 (patch)
tree36099108010e7a370eb9d2bdf3ab660c52ea792c /src/services
parent7b2401ff19c9b851d7796f4311704c446d50c4b8 (diff)
downloadmuse-c16449b08f088f35d06196c527f69b70405e7394.tar.xz
muse-c16449b08f088f35d06196c527f69b70405e7394.zip
fix: change `player.add(...)` behavior
Diffstat (limited to 'src/services')
-rw-r--r--src/services/player.ts19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/services/player.ts b/src/services/player.ts
index 4a5e161..c49e8c6 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)];
}
}