mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-09 04:35:25 +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>();
|
const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (reloadInterval == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setKey(Date.now());
|
setKey(Date.now());
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
@ -34,6 +38,10 @@ export default function AutoUpdatingCameraImage({
|
|||||||
}, [reloadInterval]);
|
}, [reloadInterval]);
|
||||||
|
|
||||||
const handleLoad = useCallback(() => {
|
const handleLoad = useCallback(() => {
|
||||||
|
if (reloadInterval == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const loadTime = Date.now() - key;
|
const loadTime = Date.now() - key;
|
||||||
|
|
||||||
if (showFps) {
|
if (showFps) {
|
||||||
|
|||||||
@ -62,6 +62,10 @@ export default function LivePlayer({
|
|||||||
// camera still state
|
// camera still state
|
||||||
|
|
||||||
const stillReloadInterval = useMemo(() => {
|
const stillReloadInterval = useMemo(() => {
|
||||||
|
if (!windowVisible) {
|
||||||
|
return -1; // no reason to update the image when the window is not visible
|
||||||
|
}
|
||||||
|
|
||||||
if (liveReady) {
|
if (liveReady) {
|
||||||
return 60000;
|
return 60000;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user