Set pause status on last track end (#291)

This commit is contained in:
jeffvli 2023-10-23 09:02:48 -07:00
parent ccfadda729
commit fdff79496a
2 changed files with 8 additions and 1 deletions

View file

@ -23,7 +23,7 @@ export const gaplessHandler = (args: {
const durationPadding = isFlac ? 0.065 : 0.116;
if (currentTime + durationPadding >= duration) {
return nextPlayerRef.current.getInternalPlayer().play();
return nextPlayerRef.current.getInternalPlayer()?.play();
}
return null;

View file

@ -261,6 +261,13 @@ export const usePlayerStore = create<PlayerSlice>()(
});
}
if (isLastTrack && repeat === PlayerRepeat.NONE) {
set((state) => {
state.current.time = 0;
state.current.status = PlayerStatus.PAUSED;
});
}
return get().actions.getPlayerData();
},
checkIsFirstTrack: () => {