diff --git a/src/renderer/features/player/hooks/use-handle-playqueue-add.ts b/src/renderer/features/player/hooks/use-handle-playqueue-add.ts index 8dbbcb55..1950b678 100644 --- a/src/renderer/features/player/hooks/use-handle-playqueue-add.ts +++ b/src/renderer/features/player/hooks/use-handle-playqueue-add.ts @@ -167,6 +167,7 @@ export const useHandlePlayQueueAdd = () => { initialSongIndex = songs.findIndex((song) => song.id === initialSongId); } + const hadSong = usePlayerStore.getState().queue.default.length > 0; const playerData = addToQueue({ initialIndex: initialSongIndex, playType, songs }); if (playerType === PlaybackType.LOCAL) { @@ -183,7 +184,11 @@ export const useHandlePlayQueueAdd = () => { } } - play(); + // We should only play if the queue was empty, or we are doing play NOW + // (override the queue). + if (playType === Play.NOW || !hadSong) { + play(); + } remote?.updateSong({ currentTime: usePlayerStore.getState().current.time, diff --git a/src/renderer/store/player.store.ts b/src/renderer/store/player.store.ts index 85a2b212..7e67523b 100644 --- a/src/renderer/store/player.store.ts +++ b/src/renderer/store/player.store.ts @@ -111,8 +111,10 @@ export const usePlayerStore = create()( ...song, uniqueId: nanoid(), })); + const queue = get().queue.default; - if (playType === Play.NOW) { + // If the queue is empty, next/last should behave the same as now + if (playType === Play.NOW || queue.length === 0) { if (get().shuffle === PlayerShuffle.TRACK) { const index = initialIndex || 0; const initialSong = songsToAddToQueue[index]; @@ -172,7 +174,6 @@ export const usePlayerStore = create()( state.queue.shuffled = shuffledQueueWithNewSongs; }); } else if (playType === Play.NEXT) { - const queue = get().queue.default; const currentIndex = get().current.index; if (get().shuffle === PlayerShuffle.TRACK) {