mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-17 08:54:27 +02:00
clear queue when shuffle now
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user