Adding fullscreen keyboard shortcut.

This commit is contained in:
Roland 2026-03-27 17:59:36 -06:00
parent d9fef1bfa2
commit 81f1456fed
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 12 additions and 0 deletions

View file

@ -34,6 +34,7 @@ export const SHORTCUTS = [
{keys: 'l', description: 'Jump forward 30 seconds', category: 'Video Player'},
{keys: 'n', description: 'Navigate to newer video', category: 'Video Player'},
{keys: 'p', description: 'Navigate to older video', category: 'Video Player'},
{keys: 'f', description: 'Toggle fullscreen', category: 'Video Player'},
];
function SearchModal({open, onClose}) {

View file

@ -250,6 +250,17 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) {
}
}, {enableOnFormTags: false}, [prevFile, navigate]);
// f: Toggle fullscreen
useHotkeys('f', () => {
if (videoRef.current) {
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
videoRef.current.requestFullscreen();
}
}
}, {enableOnFormTags: false});
if (videoFile === null) {
return <VideoPlaceholder/>;
}