Skip to content

Commit

Permalink
Add keyboard shortcut for fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed May 19, 2024
1 parent 2b4c6f0 commit eaedfe6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions web/src/components/player/VideoControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ export default function VideoControls({
onSeek(10);
}
break;
case "f":
if (setFullscreen && down && !repeat) {
setFullscreen(!fullscreen);
}
break;
case "m":
if (setMuted && down && !repeat && video) {
setMuted(!muted);
Expand All @@ -157,10 +162,10 @@ export default function VideoControls({
},
// only update when preview only changes
// eslint-disable-next-line react-hooks/exhaustive-deps
[video, isPlaying, onSeek],
[video, isPlaying, fullscreen, setFullscreen, onSeek],
);
useKeyboardListener(
hotKeys ? ["ArrowLeft", "ArrowRight", "m", " "] : [],
hotKeys ? ["ArrowLeft", "ArrowRight", "f", "m", " "] : [],
onKeyboardShortcut,
);

Expand Down

0 comments on commit eaedfe6

Please sign in to comment.