Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOL] Arrow keys don't work after toggling the Fullscreen unless clicked on the video again. #262 #301

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/components/VideoPlayer2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
player.volume(0);
}
event.stopPropagation();
break;
break;
case 'KeyK': // 'K' key for play/pause toggle
if (player.paused()) {
player.play();
Expand All @@ -169,11 +169,15 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
event.stopPropagation();
break;
case 'KeyJ': // 'J' key for seeking backward 10 seconds multiplied by the playback rate
player.currentTime(player.currentTime() - (10 * player.playbackRate()));
player.currentTime(
player.currentTime() - 10 * player.playbackRate(),
);
event.stopPropagation();
break;
case 'KeyL': // 'L' key for seeking forward 10 seconds multiplied by the playback rate
player.currentTime(player.currentTime() + (10 * player.playbackRate()));
player.currentTime(
player.currentTime() + 10 * player.playbackRate(),
);
event.stopPropagation();
break;
}
Expand Down Expand Up @@ -294,6 +298,10 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
onReady(player);
}
});
// Focus the video player when toggling fullscreen
player.on('fullscreenchange', () => {
videoElement.focus();
});
},
));

Expand Down
Loading