Skip to content

Commit

Permalink
fix: onEnterFullscreen and onExitFullscreen being executed on fir…
Browse files Browse the repository at this point in the history
…st render (#91)

Co-authored-by: Ovidiu Cristescu <[email protected]>
  • Loading branch information
heliocosta-dev and LunatiqueCoder authored May 30, 2024
1 parent 3fc416b commit b50400b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/media-console/src/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,14 @@ const AnimatedVideoPlayer = (
setResizeMode(_isFullscreen ? ResizeMode.COVER : ResizeMode.CONTAIN);
}

if (_isFullscreen) {
typeof events.onEnterFullscreen === 'function' &&
events.onEnterFullscreen();
} else {
typeof events.onExitFullscreen === 'function' &&
events.onExitFullscreen();
if (mounted.current) {
if (_isFullscreen) {
typeof events.onEnterFullscreen === 'function' &&
events.onEnterFullscreen();
} else {
typeof events.onExitFullscreen === 'function' &&
events.onExitFullscreen();
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [_isFullscreen, toggleResizeModeOnFullscreen]);
Expand Down

0 comments on commit b50400b

Please sign in to comment.