mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Add annotation support (#6288)
This commit is contained in:
parent
83006eeb65
commit
b48f6d750f
@ -269,6 +269,9 @@ class DetectConfig(FrigateBaseModel):
|
|||||||
default_factory=StationaryConfig,
|
default_factory=StationaryConfig,
|
||||||
title="Stationary objects config.",
|
title="Stationary objects config.",
|
||||||
)
|
)
|
||||||
|
annotation_offset: int = Field(
|
||||||
|
default=0, title="Milliseconds to offset detect annotations by."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FilterConfig(FrigateBaseModel):
|
class FilterConfig(FrigateBaseModel):
|
||||||
|
@ -5,7 +5,7 @@ import { formatUnixTimestampToDateTime } from '../utils/dateUtil';
|
|||||||
import PlayIcon from '../icons/Play';
|
import PlayIcon from '../icons/Play';
|
||||||
import ExitIcon from '../icons/Exit';
|
import ExitIcon from '../icons/Exit';
|
||||||
import { Zone } from '../icons/Zone';
|
import { Zone } from '../icons/Zone';
|
||||||
import { useState } from 'preact/hooks';
|
import { useMemo, useState } from 'preact/hooks';
|
||||||
import Button from './Button';
|
import Button from './Button';
|
||||||
|
|
||||||
export default function TimelineSummary({ event, onFrameSelected }) {
|
export default function TimelineSummary({ event, onFrameSelected }) {
|
||||||
@ -18,6 +18,14 @@ export default function TimelineSummary({ event, onFrameSelected }) {
|
|||||||
|
|
||||||
const { data: config } = useSWR('config');
|
const { data: config } = useSWR('config');
|
||||||
|
|
||||||
|
const annotationOffset = useMemo(() => {
|
||||||
|
if (!config) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (config.cameras[event.camera]?.detect?.annotation_offset || 0) / 1000;
|
||||||
|
}, [config, event]);
|
||||||
|
|
||||||
const [timeIndex, setTimeIndex] = useState(-1);
|
const [timeIndex, setTimeIndex] = useState(-1);
|
||||||
|
|
||||||
const recordingParams = {
|
const recordingParams = {
|
||||||
@ -53,7 +61,7 @@ export default function TimelineSummary({ event, onFrameSelected }) {
|
|||||||
|
|
||||||
const onSelectMoment = async (index) => {
|
const onSelectMoment = async (index) => {
|
||||||
setTimeIndex(index);
|
setTimeIndex(index);
|
||||||
onFrameSelected(eventTimeline[index], getSeekSeconds(eventTimeline[index].timestamp));
|
onFrameSelected(eventTimeline[index], getSeekSeconds(eventTimeline[index].timestamp + annotationOffset));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!eventTimeline || !config) {
|
if (!eventTimeline || !config) {
|
||||||
|
Loading…
Reference in New Issue
Block a user