mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 20:25:26 +03:00
Don't reload when window not visible
This commit is contained in:
parent
89c06068a9
commit
adc103ccc8
@ -23,6 +23,10 @@ export default function AutoUpdatingCameraImage({
|
||||
const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout>();
|
||||
|
||||
useEffect(() => {
|
||||
if (reloadInterval == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKey(Date.now());
|
||||
|
||||
return () => {
|
||||
@ -34,6 +38,10 @@ export default function AutoUpdatingCameraImage({
|
||||
}, [reloadInterval]);
|
||||
|
||||
const handleLoad = useCallback(() => {
|
||||
if (reloadInterval == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const loadTime = Date.now() - key;
|
||||
|
||||
if (showFps) {
|
||||
|
||||
@ -62,6 +62,10 @@ export default function LivePlayer({
|
||||
// camera still state
|
||||
|
||||
const stillReloadInterval = useMemo(() => {
|
||||
if (!windowVisible) {
|
||||
return -1; // no reason to update the image when the window is not visible
|
||||
}
|
||||
|
||||
if (liveReady) {
|
||||
return 60000;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user