1
I need to perform an action when the user leaves full screen browser mode (by pressing ESC).
I have verified that the event called is the fullscreenchange
but I couldn’t get it to work on React.
I’m using Functional Components. Follows my implementation
useEffect(() => {
if (videoElement) {
document.addEventListener('fullscreenchange', action, false);
document.addEventListener('mozfullscreenchange', action, false);
document.addEventListener('MSFullscreenChange', action, false);
document.addEventListener('webkitfullscreenchange', action, false);
}
}, [videoElement]);
if the change is taking place
videoElement
, and if it is true you add the events, would these events not have to be loaded in the component creation?– novic
So. I added another Istener within this condition.
document.addEventListener("keydown", getKeyBoardInteration, false);
this Listening is working properly, but thefullscreenchange
nay.– Lucas Junior