onEnterFullscreen
triggers unexpectedly with resizeMode="cover" on mount
#123
Labels
bug
Something isn't working
Problem:
When resizeMode is set to "cover", the component initializes
_isFullscreen
to true, which triggers theonEnterFullscreen
callback on mount, even if the video is not actually in fullscreen mode. This causes unintended side effects, especially when onEnterFullscreen contains functional logic.I believe this is the culprit:
If resizeMode === 'cover', _isFullscreen is set to true, leading to this useEffect:
Since
onEnterFullscreen
is triggered by_isFullscreen
, any logic inonEnterFullscreen
is executed even though fullscreen wasn't explicitly intended.Example:
Expected Behavior
onEnterFullscreen should only trigger when fullscreen is explicitly activated by the user or another deliberate action, not just by setting resizeMode to "cover".
Suggested Fix
Revisit how
_isFullscreen
is initialized or decoupleresizeMode="cover"
from automatic fullscreen activation. An interim solution is to ensure that resizeMode doesn't implicitly trigger fullscreen logic.The text was updated successfully, but these errors were encountered: