mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
[bugfix]: improve play behavior
- when adding songs to queue, only `play()` if the queue was empty - when adding next/last to empty queue, behavior should be same as now
This commit is contained in:
parent
0a658e3a22
commit
ae8fc6df13
2 changed files with 9 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue