Skip to content

Commit

Permalink
FixedVideoBug
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepak1649 committed Mar 31, 2024
1 parent 76a0a4b commit a2ebf9b
Showing 1 changed file with 11 additions and 3 deletions.
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

0 comments on commit a2ebf9b

Please sign in to comment.