clear queue when shuffle now

This commit is contained in:
Kendall Garner 2024-09-11 20:36:46 -07:00
parent 8221af9a8f
commit 660c9744bf
No known key found for this signature in database
GPG key ID: 18D2767419676C87

View file

@ -176,10 +176,12 @@ export const useHandlePlayQueueAdd = () => {
updateSong(playerData.current.song); updateSong(playerData.current.song);
const replacesQueue = playType === Play.NOW || playType === Play.SHUFFLE;
if (playbackType === PlaybackType.LOCAL) { if (playbackType === PlaybackType.LOCAL) {
mpvPlayer!.volume(usePlayerStore.getState().volume); mpvPlayer!.volume(usePlayerStore.getState().volume);
if (playType === Play.NOW || !hadSong) { if (replacesQueue || !hadSong) {
mpvPlayer!.pause(); mpvPlayer!.pause();
setQueue(playerData, false); setQueue(playerData, false);
} else { } else {
@ -191,14 +193,14 @@ export const useHandlePlayQueueAdd = () => {
? PlayersRef.current?.player1 ? PlayersRef.current?.player1
: PlayersRef.current?.player2; : PlayersRef.current?.player2;
const underlying = player?.getInternalPlayer(); const underlying = player?.getInternalPlayer();
if (underlying && playType === Play.NOW) { if (underlying && replacesQueue) {
underlying.currentTime = 0; underlying.currentTime = 0;
} }
} }
// We should only play if the queue was empty, or we are doing play NOW // We should only play if the queue was empty, or we are doing play NOW
// (override the queue). // (override the queue).
if (playType === Play.NOW || !hadSong) { if (replacesQueue || !hadSong) {
play(); play();
} }