mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 12:15:25 +03:00
Remove active objects when they become stationary
This commit is contained in:
parent
1fe950f55b
commit
5c52a1be7e
@ -152,12 +152,12 @@ export default function LivePlayer({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`relative flex justify-center ${className}`}>
|
<div className={`relative flex justify-center w-full ${className}`}>
|
||||||
{(showStillWithoutActivity == false || activeMotion || activeTracking) &&
|
{(showStillWithoutActivity == false || activeMotion || activeTracking) &&
|
||||||
player}
|
player}
|
||||||
|
|
||||||
{showStillWithoutActivity && !liveReady && (
|
{showStillWithoutActivity && !liveReady && (
|
||||||
<div className="absolute left-0 top-0 right-0 bottom-0">
|
<div className="absolute left-0 top-0 right-0 bottom-0 w-full">
|
||||||
<AutoUpdatingCameraImage
|
<AutoUpdatingCameraImage
|
||||||
className="w-full h-full"
|
className="w-full h-full"
|
||||||
camera={cameraConfig.name}
|
camera={cameraConfig.name}
|
||||||
@ -166,7 +166,7 @@ export default function LivePlayer({
|
|||||||
fitAspect={
|
fitAspect={
|
||||||
cameraConfig.detect.width / cameraConfig.detect.height > 2 ||
|
cameraConfig.detect.width / cameraConfig.detect.height > 2 ||
|
||||||
cameraConfig.detect.width / cameraConfig.detect.height < 1
|
cameraConfig.detect.width / cameraConfig.detect.height < 1
|
||||||
? undefined
|
? cameraConfig.detect.width / cameraConfig.detect.height
|
||||||
: 16 / 9
|
: 16 / 9
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -34,22 +34,26 @@ export default function useCameraActivity(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type == "end") {
|
const eventIndex = activeObjects.indexOf(event.after.id);
|
||||||
const eventIndex = activeObjects.indexOf(event.after.id);
|
|
||||||
|
|
||||||
|
if (event.type == "end") {
|
||||||
if (eventIndex != -1) {
|
if (eventIndex != -1) {
|
||||||
const newActiveObjects = [...activeObjects];
|
const newActiveObjects = [...activeObjects];
|
||||||
newActiveObjects.splice(eventIndex, 1);
|
newActiveObjects.splice(eventIndex, 1);
|
||||||
setActiveObjects(newActiveObjects);
|
setActiveObjects(newActiveObjects);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!event.after.stationary) {
|
if (eventIndex == -1) {
|
||||||
const eventIndex = activeObjects.indexOf(event.after.id);
|
// add unknown event to list if not stationary
|
||||||
|
if (!event.after.stationary) {
|
||||||
if (eventIndex == -1) {
|
|
||||||
const newActiveObjects = [...activeObjects, event.after.id];
|
const newActiveObjects = [...activeObjects, event.after.id];
|
||||||
setActiveObjects(newActiveObjects);
|
setActiveObjects(newActiveObjects);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// remove known event from list if it has become stationary
|
||||||
|
if (event.after.stationary) {
|
||||||
|
activeObjects.splice(eventIndex, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [event, activeObjects]);
|
}, [event, activeObjects]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user