diff --git a/frontend/src/components/VideoPlayer.tsx b/frontend/src/components/VideoPlayer.tsx index 152883c5..7684e24a 100644 --- a/frontend/src/components/VideoPlayer.tsx +++ b/frontend/src/components/VideoPlayer.tsx @@ -150,6 +150,7 @@ const VideoPlayer = ({ const resetPlaybackSpeedPressed = useKeyPress('='); const arrowRightPressed = useKeyPress('ArrowRight'); const arrowLeftPressed = useKeyPress('ArrowLeft'); + const pPausedPressed = useKeyPress('p'); const videoId = video.youtube_id; const videoUrl = video.media_url; @@ -214,6 +215,16 @@ const VideoPlayer = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [mutePressed]); + useEffect(() => { + if (pPausedPressed) { + if (videoRef.current?.paused) { + videoRef.current.play(); + } else { + videoRef.current?.pause(); + } + } + }, [pPausedPressed]); + useEffect(() => { if (increasePlaybackSpeedPressed) { const newSpeed = playbackSpeedIndex + 1; @@ -400,6 +411,10 @@ const VideoPlayer = ({