diff --git a/release/app/package-lock.json b/release/app/package-lock.json index e67da2d..be24a28 100644 --- a/release/app/package-lock.json +++ b/release/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "streamflix", - "version": "1.0.0", + "version": "1.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "streamflix", - "version": "1.0.0", + "version": "1.1.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/release/app/package.json b/release/app/package.json index 4b10579..3bd2314 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,6 +1,6 @@ { "name": "streamflix", - "version": "1.0.0", + "version": "1.1.0", "description": "A desktop app for streaming movies, tv series and anime.", "license": "MIT", "author": { diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index 2411681..e5ed8ca 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -41,6 +41,36 @@ const VideoPlayer: React.FC = () => { const [fullscreen, setFullscreen] = useState(false); const [showVolume, setShowVolume] = useState(false); const [volume, setVolume] = useState(50); + const [hideTimeout, setHideTimeout] = useState(null); + + const handleControlsVisibility = useCallback(() => { + setShowControls(true); + + if (hideTimeout) { + clearTimeout(hideTimeout); + } + + const newTimeout = setTimeout(() => { + setShowControls(false); + }, 3000); + + setHideTimeout(newTimeout); + }, [hideTimeout]); + + useEffect(() => { + const handleMouseMove = () => { + handleControlsVisibility(); + }; + + document.addEventListener('mousemove', handleMouseMove); + + return () => { + document.removeEventListener('mousemove', handleMouseMove); + if (hideTimeout) { + clearTimeout(hideTimeout); + } + }; + }, [handleControlsVisibility, hideTimeout]); const toast = useToast(); @@ -201,7 +231,7 @@ const VideoPlayer: React.FC = () => { height="100%" zIndex="9999" bg="black" - onMouseEnter={() => setShowControls(true)} + onMouseEnter={() => handleControlsVisibility()} onMouseLeave={() => setShowControls(false)} >