mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-08 03:30:01 +02:00
fix queue end handling to prevent repeat
This commit is contained in:
@@ -223,7 +223,7 @@ function calculateNextIndex(
|
||||
} else {
|
||||
// Repeat none: move to next track, or pause if at the end
|
||||
if (isLastTrack) {
|
||||
return { nextIndex: 0, shouldPause: true };
|
||||
return { nextIndex: currentIndex, shouldPause: true };
|
||||
} else {
|
||||
return { nextIndex: currentIndex + 1, shouldPause: false };
|
||||
}
|
||||
@@ -939,10 +939,12 @@ export const usePlayerStoreBase = createWithEqualityFn<PlayerState>()(
|
||||
const pauseOnNext = player.pauseOnNextSongEnd;
|
||||
const newStatus =
|
||||
shouldPause || pauseOnNext ? PlayerStatus.PAUSED : PlayerStatus.PLAYING;
|
||||
const shouldKeepCurrentPlayer = newStatus === PlayerStatus.PAUSED;
|
||||
const shouldSwapPlayer = !isRepeatOneSameTrack && !shouldKeepCurrentPlayer;
|
||||
|
||||
set((state) => {
|
||||
state.player.index = nextPlaybackIndex;
|
||||
state.player.playerNum = newPlayerNum;
|
||||
state.player.playerNum = shouldSwapPlayer ? newPlayerNum : player.playerNum;
|
||||
setTimestampStore(0);
|
||||
state.player.status = newStatus;
|
||||
|
||||
@@ -999,7 +1001,7 @@ export const usePlayerStoreBase = createWithEqualityFn<PlayerState>()(
|
||||
}
|
||||
|
||||
const { player1, player2 } = getDualPlayerSongs(
|
||||
newPlayerNum,
|
||||
shouldSwapPlayer ? newPlayerNum : player.playerNum,
|
||||
currentSong,
|
||||
nextSong,
|
||||
repeat,
|
||||
@@ -1009,7 +1011,7 @@ export const usePlayerStoreBase = createWithEqualityFn<PlayerState>()(
|
||||
currentSong,
|
||||
index: currentQueueIndex,
|
||||
nextSong,
|
||||
num: newPlayerNum,
|
||||
num: shouldSwapPlayer ? newPlayerNum : player.playerNum,
|
||||
player1,
|
||||
player2,
|
||||
previousSong,
|
||||
|
||||
Reference in New Issue
Block a user