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 (
|
||||
<div className={`relative flex justify-center ${className}`}>
|
||||
<div className={`relative flex justify-center w-full ${className}`}>
|
||||
{(showStillWithoutActivity == false || activeMotion || activeTracking) &&
|
||||
player}
|
||||
|
||||
{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
|
||||
className="w-full h-full"
|
||||
camera={cameraConfig.name}
|
||||
@ -166,7 +166,7 @@ export default function LivePlayer({
|
||||
fitAspect={
|
||||
cameraConfig.detect.width / cameraConfig.detect.height > 2 ||
|
||||
cameraConfig.detect.width / cameraConfig.detect.height < 1
|
||||
? undefined
|
||||
? cameraConfig.detect.width / cameraConfig.detect.height
|
||||
: 16 / 9
|
||||
}
|
||||
/>
|
||||
|
||||
@ -34,22 +34,26 @@ export default function useCameraActivity(
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.type == "end") {
|
||||
const eventIndex = activeObjects.indexOf(event.after.id);
|
||||
|
||||
if (event.type == "end") {
|
||||
if (eventIndex != -1) {
|
||||
const newActiveObjects = [...activeObjects];
|
||||
newActiveObjects.splice(eventIndex, 1);
|
||||
setActiveObjects(newActiveObjects);
|
||||
}
|
||||
} else {
|
||||
if (!event.after.stationary) {
|
||||
const eventIndex = activeObjects.indexOf(event.after.id);
|
||||
|
||||
if (eventIndex == -1) {
|
||||
// add unknown event to list if not stationary
|
||||
if (!event.after.stationary) {
|
||||
const newActiveObjects = [...activeObjects, event.after.id];
|
||||
setActiveObjects(newActiveObjects);
|
||||
}
|
||||
} else {
|
||||
// remove known event from list if it has become stationary
|
||||
if (event.after.stationary) {
|
||||
activeObjects.splice(eventIndex, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [event, activeObjects]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user