Browse Source

Modify "STOP" key behavior (#200)

- Clear queue -> Pause playback and reset seek to 0
master
jeffvli 3 years ago
parent
commit
3182947086
  1. 22
      src/hooks/usePlayerControls.ts

22
src/hooks/usePlayerControls.ts

@ -128,24 +128,20 @@ const usePlayerControls = (
}, [dispatch, playQueue.currentPlayer, playersRef]);
const handleStop = useCallback(() => {
if (playQueue.currentPlayer === 1) {
playersRef.current.player2.audioEl.current.pause();
playersRef.current.player2.audioEl.current.currentTime = 0;
} else {
playersRef.current.player1.audioEl.current.pause();
playersRef.current.player1.audioEl.current.currentTime = 0;
}
playersRef.current.player2.audioEl.current.pause();
playersRef.current.player2.audioEl.current.currentTime = 0;
playersRef.current.player1.audioEl.current.pause();
playersRef.current.player1.audioEl.current.currentTime = 0;
ipcRenderer.send('playpause', {
status: 'PAUSED',
position:
playQueue.currentPlayer === 1
? Math.floor(playersRef.current.player1.audioEl.current.currentTime * 1000000)
: Math.floor(playersRef.current.player2.audioEl.current.currentTime * 1000000),
position: 0,
});
dispatch(setStatus('PAUSED'));
}, [dispatch, playQueue.currentPlayer, playersRef]);
setTimeout(() => {
dispatch(setStatus('PAUSED'));
}, 250);
}, [dispatch, playersRef]);
const handleSeekBackward = useCallback(() => {
const seekBackwardInterval = Number(settings.getSync('seekBackwardInterval'));

Loading…
Cancel
Save