Add keyboard shortcut for fullscreen

This commit is contained in:
Nicolas Mowen 2024-05-19 06:16:55 -06:00
parent 2b4c6f0e19
commit eaedfe6070

View File

@ -143,6 +143,11 @@ export default function VideoControls({
onSeek(10); onSeek(10);
} }
break; break;
case "f":
if (setFullscreen && down && !repeat) {
setFullscreen(!fullscreen);
}
break;
case "m": case "m":
if (setMuted && down && !repeat && video) { if (setMuted && down && !repeat && video) {
setMuted(!muted); setMuted(!muted);
@ -157,10 +162,10 @@ export default function VideoControls({
}, },
// only update when preview only changes // only update when preview only changes
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
[video, isPlaying, onSeek], [video, isPlaying, fullscreen, setFullscreen, onSeek],
); );
useKeyboardListener( useKeyboardListener(
hotKeys ? ["ArrowLeft", "ArrowRight", "m", " "] : [], hotKeys ? ["ArrowLeft", "ArrowRight", "f", "m", " "] : [],
onKeyboardShortcut, onKeyboardShortcut,
); );