Skip to content

Commit

Permalink
Set pause status on last track end (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffvli committed Oct 23, 2023
1 parent ccfadda commit fdff794
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/store/player.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => {
Expand Down

1 comment on commit fdff794

@vercel
Copy link

@vercel vercel bot commented on fdff794 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

feishin – ./

feishin-git-development-jeffvli.vercel.app
feishin-jeffvli.vercel.app
feishin.vercel.app

Please sign in to comment.