From ec6224566171782d44f1eb581a31f14cd3f00d94 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sat, 9 Apr 2022 20:37:11 -0700 Subject: [PATCH] Enable "stop" button when paused (#273) --- src/components/player/PlayerBar.tsx | 2 +- src/hooks/usePlayerControls.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/player/PlayerBar.tsx b/src/components/player/PlayerBar.tsx index bc6e672..4c25f7a 100644 --- a/src/components/player/PlayerBar.tsx +++ b/src/components/player/PlayerBar.tsx @@ -463,7 +463,7 @@ const PlayerBar = () => { icon="stop" size="lg" fixedWidth - disabled={playQueue.entry.length === 0 || player.status !== 'PLAYING'} + disabled={playQueue.entry.length === 0} onClick={handleStop} onKeyDown={(e: any) => { if (e.key === ' ' || e.key === 'Enter') { diff --git a/src/hooks/usePlayerControls.ts b/src/hooks/usePlayerControls.ts index 7317d45..b9d5ca1 100644 --- a/src/hooks/usePlayerControls.ts +++ b/src/hooks/usePlayerControls.ts @@ -166,6 +166,7 @@ const usePlayerControls = ( playersRef.current.player2.audioEl.current.currentTime = 0; playersRef.current.player1.audioEl.current.pause(); playersRef.current.player1.audioEl.current.currentTime = 0; + setCurrentTime(0); ipcRenderer.send('playpause', { status: 'PAUSED', @@ -175,7 +176,7 @@ const usePlayerControls = ( setTimeout(() => { dispatch(setStatus('PAUSED')); }, 250); - }, [dispatch, playersRef]); + }, [dispatch, playersRef, setCurrentTime]); const handleSeekBackward = useCallback(() => { const seekBackwardInterval = Number(settings.getSync('seekBackwardInterval'));