mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Open to recordings with pre-buffer (#11143)
* Open to recordings with pre-buffer * Reduce buffer * Use variable for preview FPS
This commit is contained in:
parent
9117043adc
commit
c9246bd4ab
@ -23,6 +23,7 @@ import useContextMenu from "@/hooks/use-contextmenu";
|
|||||||
import ActivityIndicator from "../indicators/activity-indicator";
|
import ActivityIndicator from "../indicators/activity-indicator";
|
||||||
import { TimeRange } from "@/types/timeline";
|
import { TimeRange } from "@/types/timeline";
|
||||||
import { NoThumbSlider } from "../ui/slider";
|
import { NoThumbSlider } from "../ui/slider";
|
||||||
|
import { PREVIEW_FPS, PREVIEW_PADDING } from "@/types/preview";
|
||||||
|
|
||||||
type PreviewPlayerProps = {
|
type PreviewPlayerProps = {
|
||||||
review: ReviewSegment;
|
review: ReviewSegment;
|
||||||
@ -337,7 +338,6 @@ function PreviewContent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREVIEW_PADDING = 16;
|
|
||||||
type VideoPreviewProps = {
|
type VideoPreviewProps = {
|
||||||
relevantPreview: Preview;
|
relevantPreview: Preview;
|
||||||
startTime: number;
|
startTime: number;
|
||||||
@ -398,7 +398,7 @@ export function VideoPreview({
|
|||||||
setManualPlayback(true);
|
setManualPlayback(true);
|
||||||
} else {
|
} else {
|
||||||
playerRef.current.currentTime = playerStartTime;
|
playerRef.current.currentTime = playerStartTime;
|
||||||
playerRef.current.playbackRate = 8;
|
playerRef.current.playbackRate = PREVIEW_FPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we know that these deps are correct
|
// we know that these deps are correct
|
||||||
@ -470,7 +470,7 @@ export function VideoPreview({
|
|||||||
playerRef.current.currentTime = playerStartTime + counter;
|
playerRef.current.currentTime = playerStartTime + counter;
|
||||||
counter += 1;
|
counter += 1;
|
||||||
}
|
}
|
||||||
}, 125);
|
}, 1000 / PREVIEW_FPS);
|
||||||
return () => clearInterval(intervalId);
|
return () => clearInterval(intervalId);
|
||||||
|
|
||||||
// we know that these deps are correct
|
// we know that these deps are correct
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { REVIEW_PADDING } from "./review";
|
||||||
|
|
||||||
export type Preview = {
|
export type Preview = {
|
||||||
camera: string;
|
camera: string;
|
||||||
src: string;
|
src: string;
|
||||||
@ -5,3 +7,6 @@ export type Preview = {
|
|||||||
start: number;
|
start: number;
|
||||||
end: number;
|
end: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const PREVIEW_FPS = 8;
|
||||||
|
export const PREVIEW_PADDING = REVIEW_PADDING * PREVIEW_FPS;
|
||||||
|
@ -48,3 +48,5 @@ export type MotionData = {
|
|||||||
audio?: number;
|
audio?: number;
|
||||||
camera: string;
|
camera: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const REVIEW_PADDING = 2;
|
||||||
|
@ -12,6 +12,7 @@ import { FrigateConfig } from "@/types/frigateConfig";
|
|||||||
import { Preview } from "@/types/preview";
|
import { Preview } from "@/types/preview";
|
||||||
import {
|
import {
|
||||||
MotionData,
|
MotionData,
|
||||||
|
REVIEW_PADDING,
|
||||||
ReviewFilter,
|
ReviewFilter,
|
||||||
ReviewSegment,
|
ReviewSegment,
|
||||||
ReviewSeverity,
|
ReviewSeverity,
|
||||||
@ -175,7 +176,7 @@ export default function EventView({
|
|||||||
} else {
|
} else {
|
||||||
onOpenRecording({
|
onOpenRecording({
|
||||||
camera: review.camera,
|
camera: review.camera,
|
||||||
startTime: review.start_time,
|
startTime: review.start_time - REVIEW_PADDING,
|
||||||
severity: review.severity,
|
severity: review.severity,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user