Skip to content

Commit

Permalink
fix fullscreen button
Browse files Browse the repository at this point in the history
  • Loading branch information
jackrifkin committed Jun 17, 2024
1 parent b432470 commit 68a1512
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pages/Components/VideoWithToolbar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const VideoWithToolbar = ({ src, loops = true, hasToolbar = true }) => {

const toggleFullscreen = () => {
const videoElement = videoRef.current;
videoElement.playsInline = !videoElement.playsInline;
if (!document.fullscreenElement) {
videoElement.requestFullscreen();
} else {
Expand Down Expand Up @@ -67,6 +68,7 @@ const VideoWithToolbar = ({ src, loops = true, hasToolbar = true }) => {
useEffect(() => {
const videoElement = videoRef.current;
if (videoElement) {
setIsMuted(videoElement.muted)
videoElement.addEventListener("loadedmetadata", calculateVideoDimensions);
window.addEventListener("resize", calculateVideoDimensions);
document.addEventListener("fullscreenchange", handleFullScreenChange);
Expand Down

0 comments on commit 68a1512

Please sign in to comment.