stop resize if user switches browser tab

This commit is contained in:
Ramon Souza 2021-08-18 09:38:59 -03:00
parent c25ec18bd2
commit 7bc9ac82c0

View File

@ -33,6 +33,20 @@ const WebcamComponent = ({
|| cameraDock.position === CAMERADOCK_POSITION.CONTENT_RIGHT;
const isCameraSidebar = cameraDock.position === CAMERADOCK_POSITION.SIDEBAR_CONTENT_BOTTOM;
useEffect(() => {
const handleVisibility = () => {
if (document.hidden) {
document.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));
}
};
document.addEventListener('visibilitychange', handleVisibility);
return () => {
document.removeEventListener('visibilitychange', handleVisibility);
};
}, []);
useEffect(() => {
setIsFullScreen(fullscreen.group === 'webcams');
}, [fullscreen]);