2024-02-23 01:03:34 +01:00
|
|
|
import DynamicVideoPlayer, {
|
|
|
|
DynamicVideoController,
|
|
|
|
} from "@/components/player/DynamicVideoPlayer";
|
2024-03-12 00:31:05 +01:00
|
|
|
import PreviewPlayer, {
|
|
|
|
PreviewController,
|
|
|
|
} from "@/components/player/PreviewPlayer";
|
2024-02-23 01:03:34 +01:00
|
|
|
import EventReviewTimeline from "@/components/timeline/EventReviewTimeline";
|
2024-03-05 20:55:44 +01:00
|
|
|
import MotionReviewTimeline from "@/components/timeline/MotionReviewTimeline";
|
2024-02-23 01:03:34 +01:00
|
|
|
import { Button } from "@/components/ui/button";
|
2024-03-10 14:17:09 +01:00
|
|
|
import {
|
|
|
|
DropdownMenu,
|
|
|
|
DropdownMenuContent,
|
|
|
|
DropdownMenuRadioGroup,
|
|
|
|
DropdownMenuRadioItem,
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
} from "@/components/ui/dropdown-menu";
|
2024-03-12 00:31:05 +01:00
|
|
|
import { FrigateConfig } from "@/types/frigateConfig";
|
2024-02-28 23:23:56 +01:00
|
|
|
import { Preview } from "@/types/preview";
|
2024-03-05 20:55:44 +01:00
|
|
|
import { MotionData, ReviewSegment, ReviewSeverity } from "@/types/review";
|
2024-03-04 05:21:30 +01:00
|
|
|
import { getChunkedTimeDay } from "@/utils/timelineUtil";
|
2024-03-05 13:03:10 +01:00
|
|
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
2024-02-23 01:03:34 +01:00
|
|
|
import { IoMdArrowRoundBack } from "react-icons/io";
|
|
|
|
import { useNavigate } from "react-router-dom";
|
2024-03-05 20:55:44 +01:00
|
|
|
import useSWR from "swr";
|
|
|
|
|
|
|
|
const SEGMENT_DURATION = 30;
|
2024-02-23 01:03:34 +01:00
|
|
|
|
2024-03-05 13:03:10 +01:00
|
|
|
type DesktopRecordingViewProps = {
|
|
|
|
startCamera: string;
|
|
|
|
startTime: number;
|
|
|
|
severity: ReviewSeverity;
|
|
|
|
reviewItems: ReviewSegment[];
|
|
|
|
allCameras: string[];
|
|
|
|
allPreviews?: Preview[];
|
|
|
|
};
|
|
|
|
export function DesktopRecordingView({
|
|
|
|
startCamera,
|
|
|
|
startTime,
|
|
|
|
severity,
|
|
|
|
reviewItems,
|
|
|
|
allCameras,
|
|
|
|
allPreviews,
|
|
|
|
}: DesktopRecordingViewProps) {
|
2024-03-12 00:31:05 +01:00
|
|
|
const { data: config } = useSWR<FrigateConfig>("config");
|
2024-03-05 13:03:10 +01:00
|
|
|
const navigate = useNavigate();
|
|
|
|
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
|
|
|
|
|
|
// controller state
|
|
|
|
|
|
|
|
const [mainCamera, setMainCamera] = useState(startCamera);
|
2024-03-12 00:31:05 +01:00
|
|
|
const mainControllerRef = useRef<DynamicVideoController | null>(null);
|
|
|
|
const previewRefs = useRef<{ [camera: string]: PreviewController }>({});
|
2024-03-05 13:03:10 +01:00
|
|
|
|
2024-03-10 14:17:09 +01:00
|
|
|
const [playbackStart, setPlaybackStart] = useState(startTime);
|
|
|
|
|
2024-03-12 18:08:31 +01:00
|
|
|
const mainCameraReviewItems = useMemo(
|
|
|
|
() => reviewItems.filter((cam) => cam.camera == mainCamera),
|
|
|
|
[reviewItems, mainCamera],
|
|
|
|
);
|
|
|
|
|
2024-03-05 13:03:10 +01:00
|
|
|
// timeline time
|
|
|
|
|
|
|
|
const timeRange = useMemo(() => getChunkedTimeDay(startTime), [startTime]);
|
|
|
|
const [selectedRangeIdx, setSelectedRangeIdx] = useState(
|
|
|
|
timeRange.ranges.findIndex((chunk) => {
|
|
|
|
return chunk.start <= startTime && chunk.end >= startTime;
|
|
|
|
}),
|
|
|
|
);
|
2024-03-08 01:31:43 +01:00
|
|
|
const currentTimeRange = useMemo(
|
|
|
|
() => timeRange.ranges[selectedRangeIdx],
|
|
|
|
[selectedRangeIdx, timeRange],
|
|
|
|
);
|
2024-03-05 13:03:10 +01:00
|
|
|
|
|
|
|
// move to next clip
|
|
|
|
useEffect(() => {
|
2024-03-12 00:31:05 +01:00
|
|
|
if (!mainControllerRef.current) {
|
2024-03-05 13:03:10 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-03-12 00:31:05 +01:00
|
|
|
mainControllerRef.current.onClipChangedEvent((dir) => {
|
|
|
|
if (dir == "forward") {
|
|
|
|
if (selectedRangeIdx < timeRange.ranges.length - 1) {
|
|
|
|
setSelectedRangeIdx(selectedRangeIdx + 1);
|
2024-03-05 13:03:10 +01:00
|
|
|
}
|
2024-03-12 00:31:05 +01:00
|
|
|
}
|
|
|
|
});
|
2024-03-09 00:24:12 +01:00
|
|
|
// we only want to fire once when players are ready
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2024-03-12 00:31:05 +01:00
|
|
|
}, [selectedRangeIdx, timeRange, mainControllerRef.current, mainCamera]);
|
2024-03-05 13:03:10 +01:00
|
|
|
|
|
|
|
// scrubbing and timeline state
|
|
|
|
|
|
|
|
const [scrubbing, setScrubbing] = useState(false);
|
|
|
|
const [currentTime, setCurrentTime] = useState<number>(startTime);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (scrubbing) {
|
2024-03-08 01:31:43 +01:00
|
|
|
if (
|
|
|
|
currentTime > currentTimeRange.end + 60 ||
|
|
|
|
currentTime < currentTimeRange.start - 60
|
|
|
|
) {
|
|
|
|
const index = timeRange.ranges.findIndex(
|
|
|
|
(seg) => seg.start <= currentTime && seg.end >= currentTime,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (index != -1) {
|
|
|
|
setSelectedRangeIdx(index);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-03-12 00:31:05 +01:00
|
|
|
mainControllerRef.current?.scrubToTimestamp(currentTime);
|
|
|
|
|
|
|
|
Object.values(previewRefs.current).forEach((controller) => {
|
2024-03-05 13:03:10 +01:00
|
|
|
controller.scrubToTimestamp(currentTime);
|
|
|
|
});
|
|
|
|
}
|
2024-03-08 01:31:43 +01:00
|
|
|
}, [currentTime, scrubbing, timeRange, currentTimeRange]);
|
2024-03-05 13:03:10 +01:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (!scrubbing) {
|
2024-03-12 00:31:05 +01:00
|
|
|
mainControllerRef.current?.seekToTimestamp(currentTime, true);
|
2024-03-05 13:03:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// we only want to seek when user stops scrubbing
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, [scrubbing]);
|
|
|
|
|
|
|
|
const onSelectCamera = useCallback(
|
|
|
|
(newCam: string) => {
|
|
|
|
setMainCamera(newCam);
|
2024-03-12 00:31:05 +01:00
|
|
|
setPlaybackStart(currentTime);
|
2024-03-05 13:03:10 +01:00
|
|
|
},
|
2024-03-12 00:31:05 +01:00
|
|
|
[currentTime],
|
2024-03-05 13:03:10 +01:00
|
|
|
);
|
|
|
|
|
2024-03-05 20:55:44 +01:00
|
|
|
// motion timeline data
|
|
|
|
|
|
|
|
const { data: motionData } = useSWR<MotionData[]>(
|
|
|
|
severity == "significant_motion"
|
|
|
|
? [
|
2024-03-12 16:24:18 +01:00
|
|
|
"review/activity/motion",
|
2024-03-05 20:55:44 +01:00
|
|
|
{
|
|
|
|
before: timeRange.end,
|
|
|
|
after: timeRange.start,
|
|
|
|
scale: SEGMENT_DURATION / 2,
|
2024-03-12 18:08:31 +01:00
|
|
|
cameras: mainCamera,
|
2024-03-05 20:55:44 +01:00
|
|
|
},
|
|
|
|
]
|
|
|
|
: null,
|
|
|
|
);
|
|
|
|
|
2024-03-12 00:31:05 +01:00
|
|
|
const grow = useMemo(() => {
|
|
|
|
if (!config) {
|
|
|
|
return "aspect-video";
|
|
|
|
}
|
|
|
|
|
|
|
|
const aspectRatio =
|
|
|
|
config.cameras[mainCamera].detect.width /
|
|
|
|
config.cameras[mainCamera].detect.height;
|
|
|
|
if (aspectRatio > 2) {
|
|
|
|
return "aspect-wide";
|
|
|
|
} else {
|
|
|
|
return "aspect-video";
|
|
|
|
}
|
|
|
|
}, [config, mainCamera]);
|
|
|
|
|
2024-03-05 13:03:10 +01:00
|
|
|
return (
|
|
|
|
<div ref={contentRef} className="relative size-full">
|
|
|
|
<Button
|
|
|
|
className="absolute top-0 left-0 rounded-lg"
|
|
|
|
onClick={() => navigate(-1)}
|
|
|
|
>
|
|
|
|
<IoMdArrowRoundBack className="size-5 mr-[10px]" />
|
|
|
|
Back
|
|
|
|
</Button>
|
|
|
|
|
2024-03-11 23:07:56 +01:00
|
|
|
<div className="flex h-full justify-center overflow-hidden">
|
|
|
|
<div className="flex flex-1 flex-wrap">
|
2024-03-12 00:31:05 +01:00
|
|
|
<div className="w-full flex flex-col h-full px-2 justify-center items-center">
|
|
|
|
<div
|
|
|
|
key={mainCamera}
|
|
|
|
className="w-[82%] flex justify-center items mb-5"
|
|
|
|
>
|
2024-03-05 13:03:10 +01:00
|
|
|
<DynamicVideoPlayer
|
2024-03-12 00:31:05 +01:00
|
|
|
className={`w-full ${grow}`}
|
2024-03-11 23:07:56 +01:00
|
|
|
camera={mainCamera}
|
2024-03-08 01:31:43 +01:00
|
|
|
timeRange={currentTimeRange}
|
2024-03-05 13:03:10 +01:00
|
|
|
cameraPreviews={allPreviews ?? []}
|
2024-03-11 23:07:56 +01:00
|
|
|
startTime={playbackStart}
|
2024-03-05 13:03:10 +01:00
|
|
|
onControllerReady={(controller) => {
|
2024-03-12 00:31:05 +01:00
|
|
|
mainControllerRef.current = controller;
|
2024-03-11 23:07:56 +01:00
|
|
|
controller.onPlayerTimeUpdate((timestamp: number) => {
|
|
|
|
setCurrentTime(timestamp);
|
2024-03-12 03:42:13 +01:00
|
|
|
Object.values(previewRefs.current ?? {}).forEach((prev) =>
|
|
|
|
prev.scrubToTimestamp(Math.floor(timestamp)),
|
|
|
|
);
|
2024-03-11 23:07:56 +01:00
|
|
|
});
|
2024-03-05 13:03:10 +01:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
2024-03-12 00:31:05 +01:00
|
|
|
<div className="w-full flex justify-center gap-2 overflow-x-auto">
|
2024-03-11 23:07:56 +01:00
|
|
|
{allCameras.map((cam) => {
|
|
|
|
if (cam !== mainCamera) {
|
|
|
|
return (
|
2024-03-12 00:31:05 +01:00
|
|
|
<div key={cam}>
|
|
|
|
<PreviewPlayer
|
2024-03-11 23:07:56 +01:00
|
|
|
className="size-full"
|
|
|
|
camera={cam}
|
|
|
|
timeRange={currentTimeRange}
|
|
|
|
cameraPreviews={allPreviews ?? []}
|
2024-03-12 00:31:05 +01:00
|
|
|
startTime={startTime}
|
2024-03-11 23:07:56 +01:00
|
|
|
onControllerReady={(controller) => {
|
2024-03-12 00:31:05 +01:00
|
|
|
previewRefs.current[cam] = controller;
|
|
|
|
controller.scrubToTimestamp(startTime);
|
2024-03-11 23:07:56 +01:00
|
|
|
}}
|
|
|
|
onClick={() => onSelectCamera(cam)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-05 13:03:10 +01:00
|
|
|
|
2024-03-11 23:07:56 +01:00
|
|
|
<div className="w-[55px] md:w-[100px] mt-2 overflow-y-auto no-scrollbar">
|
|
|
|
{severity != "significant_motion" ? (
|
|
|
|
<EventReviewTimeline
|
|
|
|
segmentDuration={30}
|
|
|
|
timestampSpread={15}
|
|
|
|
timelineStart={timeRange.end}
|
|
|
|
timelineEnd={timeRange.start}
|
|
|
|
showHandlebar
|
|
|
|
handlebarTime={currentTime}
|
|
|
|
setHandlebarTime={setCurrentTime}
|
2024-03-12 18:08:31 +01:00
|
|
|
events={mainCameraReviewItems}
|
2024-03-11 23:07:56 +01:00
|
|
|
severityType={severity}
|
|
|
|
contentRef={contentRef}
|
|
|
|
onHandlebarDraggingChange={(scrubbing) => setScrubbing(scrubbing)}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<MotionReviewTimeline
|
|
|
|
segmentDuration={30}
|
|
|
|
timestampSpread={15}
|
|
|
|
timelineStart={timeRange.end}
|
|
|
|
timelineEnd={timeRange.start}
|
|
|
|
showHandlebar
|
|
|
|
handlebarTime={currentTime}
|
|
|
|
setHandlebarTime={setCurrentTime}
|
2024-03-12 18:08:31 +01:00
|
|
|
events={mainCameraReviewItems}
|
2024-03-11 23:07:56 +01:00
|
|
|
motion_events={motionData ?? []}
|
|
|
|
severityType={severity}
|
|
|
|
contentRef={contentRef}
|
|
|
|
onHandlebarDraggingChange={(scrubbing) => setScrubbing(scrubbing)}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
2024-03-05 13:03:10 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
type MobileRecordingViewProps = {
|
2024-03-05 20:55:44 +01:00
|
|
|
startCamera: string;
|
|
|
|
startTime: number;
|
|
|
|
severity: ReviewSeverity;
|
2024-02-23 01:03:34 +01:00
|
|
|
reviewItems: ReviewSegment[];
|
|
|
|
relevantPreviews?: Preview[];
|
2024-03-10 14:17:09 +01:00
|
|
|
allCameras: string[];
|
2024-02-23 01:03:34 +01:00
|
|
|
};
|
2024-03-05 13:03:10 +01:00
|
|
|
export function MobileRecordingView({
|
2024-03-05 20:55:44 +01:00
|
|
|
startCamera,
|
|
|
|
startTime,
|
|
|
|
severity,
|
2024-02-23 01:03:34 +01:00
|
|
|
reviewItems,
|
|
|
|
relevantPreviews,
|
2024-03-10 14:17:09 +01:00
|
|
|
allCameras,
|
2024-03-05 13:03:10 +01:00
|
|
|
}: MobileRecordingViewProps) {
|
2024-02-23 01:03:34 +01:00
|
|
|
const navigate = useNavigate();
|
|
|
|
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
|
|
|
2024-02-26 17:04:56 +01:00
|
|
|
// controller state
|
|
|
|
|
|
|
|
const [playerReady, setPlayerReady] = useState(false);
|
|
|
|
const controllerRef = useRef<DynamicVideoController | undefined>(undefined);
|
2024-03-10 14:17:09 +01:00
|
|
|
const [playbackCamera, setPlaybackCamera] = useState(startCamera);
|
|
|
|
const [playbackStart, setPlaybackStart] = useState(startTime);
|
2024-02-26 17:04:56 +01:00
|
|
|
|
2024-02-23 01:03:34 +01:00
|
|
|
// timeline time
|
|
|
|
|
2024-03-05 20:55:44 +01:00
|
|
|
const timeRange = useMemo(() => getChunkedTimeDay(startTime), [startTime]);
|
2024-02-23 01:03:34 +01:00
|
|
|
const [selectedRangeIdx, setSelectedRangeIdx] = useState(
|
|
|
|
timeRange.ranges.findIndex((chunk) => {
|
2024-03-05 20:55:44 +01:00
|
|
|
return chunk.start <= startTime && chunk.end >= startTime;
|
2024-02-28 23:23:56 +01:00
|
|
|
}),
|
2024-02-23 01:03:34 +01:00
|
|
|
);
|
2024-03-08 01:31:43 +01:00
|
|
|
const currentTimeRange = useMemo(
|
|
|
|
() => timeRange.ranges[selectedRangeIdx],
|
|
|
|
[selectedRangeIdx, timeRange],
|
|
|
|
);
|
2024-02-23 01:03:34 +01:00
|
|
|
|
2024-03-12 18:08:31 +01:00
|
|
|
const mainCameraReviewItems = useMemo(
|
|
|
|
() => reviewItems.filter((cam) => cam.camera == playbackCamera),
|
|
|
|
[reviewItems, playbackCamera],
|
|
|
|
);
|
|
|
|
|
2024-02-23 01:03:34 +01:00
|
|
|
// move to next clip
|
|
|
|
useEffect(() => {
|
|
|
|
if (!controllerRef.current) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-02-26 17:04:56 +01:00
|
|
|
controllerRef.current.onClipChangedEvent((dir) => {
|
2024-03-08 01:31:43 +01:00
|
|
|
if (dir == "forward") {
|
|
|
|
if (selectedRangeIdx < timeRange.ranges.length - 1) {
|
|
|
|
setSelectedRangeIdx(selectedRangeIdx + 1);
|
|
|
|
}
|
2024-02-26 17:04:56 +01:00
|
|
|
}
|
|
|
|
});
|
2024-02-28 23:23:56 +01:00
|
|
|
}, [playerReady, selectedRangeIdx, timeRange]);
|
2024-02-23 01:03:34 +01:00
|
|
|
|
|
|
|
// scrubbing and timeline state
|
|
|
|
|
|
|
|
const [scrubbing, setScrubbing] = useState(false);
|
|
|
|
const [currentTime, setCurrentTime] = useState<number>(
|
2024-03-05 20:55:44 +01:00
|
|
|
startTime || Date.now() / 1000,
|
2024-02-23 01:03:34 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (scrubbing) {
|
2024-03-08 01:31:43 +01:00
|
|
|
if (
|
|
|
|
currentTime > currentTimeRange.end + 60 ||
|
|
|
|
currentTime < currentTimeRange.start - 60
|
|
|
|
) {
|
|
|
|
const index = timeRange.ranges.findIndex(
|
|
|
|
(seg) => seg.start <= currentTime && seg.end >= currentTime,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (index != -1) {
|
|
|
|
setSelectedRangeIdx(index);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-02-23 01:03:34 +01:00
|
|
|
controllerRef.current?.scrubToTimestamp(currentTime);
|
|
|
|
}
|
2024-03-08 01:31:43 +01:00
|
|
|
}, [currentTime, scrubbing, currentTimeRange, timeRange]);
|
2024-02-23 01:03:34 +01:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (!scrubbing) {
|
|
|
|
controllerRef.current?.seekToTimestamp(currentTime, true);
|
|
|
|
}
|
2024-02-28 23:23:56 +01:00
|
|
|
|
|
|
|
// we only want to seek when user stops scrubbing
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2024-02-26 17:04:56 +01:00
|
|
|
}, [scrubbing]);
|
2024-02-23 01:03:34 +01:00
|
|
|
|
2024-03-05 20:55:44 +01:00
|
|
|
// motion timeline data
|
|
|
|
|
|
|
|
const { data: motionData } = useSWR<MotionData[]>(
|
|
|
|
severity == "significant_motion"
|
|
|
|
? [
|
2024-03-12 16:24:18 +01:00
|
|
|
"review/activity/motion",
|
2024-03-05 20:55:44 +01:00
|
|
|
{
|
|
|
|
before: timeRange.end,
|
|
|
|
after: timeRange.start,
|
|
|
|
scale: SEGMENT_DURATION / 2,
|
2024-03-12 18:08:31 +01:00
|
|
|
cameras: playbackCamera,
|
2024-03-05 20:55:44 +01:00
|
|
|
},
|
|
|
|
]
|
|
|
|
: null,
|
|
|
|
);
|
|
|
|
|
2024-02-23 01:03:34 +01:00
|
|
|
return (
|
2024-03-04 14:35:10 +01:00
|
|
|
<div ref={contentRef} className="flex flex-col relative w-full h-full">
|
2024-03-11 14:05:44 +01:00
|
|
|
<div className="flex justify-evenly items-center p-2">
|
2024-03-10 14:17:09 +01:00
|
|
|
<Button className="rounded-lg" onClick={() => navigate(-1)}>
|
|
|
|
<IoMdArrowRoundBack className="size-5 mr-[10px]" />
|
|
|
|
Back
|
|
|
|
</Button>
|
|
|
|
<DropdownMenu>
|
|
|
|
<DropdownMenuTrigger asChild>
|
|
|
|
<Button className="capitalize">
|
|
|
|
{playbackCamera.replaceAll("_", " ")}
|
|
|
|
</Button>
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent>
|
|
|
|
<DropdownMenuRadioGroup
|
|
|
|
value={playbackCamera}
|
|
|
|
onValueChange={(cam) => {
|
|
|
|
setPlaybackStart(currentTime);
|
|
|
|
setPlaybackCamera(cam);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{allCameras.map((cam) => (
|
|
|
|
<DropdownMenuRadioItem
|
|
|
|
key={cam}
|
|
|
|
className="capitalize"
|
|
|
|
value={cam}
|
|
|
|
>
|
|
|
|
{cam.replaceAll("_", " ")}
|
|
|
|
</DropdownMenuRadioItem>
|
|
|
|
))}
|
|
|
|
</DropdownMenuRadioGroup>
|
|
|
|
</DropdownMenuContent>
|
|
|
|
</DropdownMenu>
|
|
|
|
</div>
|
2024-02-23 01:03:34 +01:00
|
|
|
|
2024-03-05 13:03:10 +01:00
|
|
|
<div>
|
2024-02-23 01:03:34 +01:00
|
|
|
<DynamicVideoPlayer
|
2024-03-10 14:17:09 +01:00
|
|
|
camera={playbackCamera}
|
2024-03-08 01:31:43 +01:00
|
|
|
timeRange={currentTimeRange}
|
2024-02-23 01:03:34 +01:00
|
|
|
cameraPreviews={relevantPreviews || []}
|
2024-03-10 14:17:09 +01:00
|
|
|
startTime={playbackStart}
|
2024-02-23 01:03:34 +01:00
|
|
|
onControllerReady={(controller) => {
|
|
|
|
controllerRef.current = controller;
|
2024-02-26 17:04:56 +01:00
|
|
|
setPlayerReady(true);
|
2024-02-23 01:03:34 +01:00
|
|
|
controllerRef.current.onPlayerTimeUpdate((timestamp: number) => {
|
|
|
|
setCurrentTime(timestamp);
|
|
|
|
});
|
|
|
|
|
2024-03-05 20:55:44 +01:00
|
|
|
controllerRef.current?.seekToTimestamp(startTime, true);
|
2024-02-23 01:03:34 +01:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
2024-03-05 13:03:10 +01:00
|
|
|
<div className="flex-grow overflow-hidden">
|
2024-03-05 20:55:44 +01:00
|
|
|
{severity != "significant_motion" ? (
|
|
|
|
<EventReviewTimeline
|
|
|
|
segmentDuration={30}
|
|
|
|
timestampSpread={15}
|
|
|
|
timelineStart={timeRange.end}
|
|
|
|
timelineEnd={timeRange.start}
|
|
|
|
showHandlebar
|
|
|
|
handlebarTime={currentTime}
|
|
|
|
setHandlebarTime={setCurrentTime}
|
2024-03-12 18:08:31 +01:00
|
|
|
events={mainCameraReviewItems}
|
2024-03-05 20:55:44 +01:00
|
|
|
severityType={severity}
|
|
|
|
contentRef={contentRef}
|
|
|
|
onHandlebarDraggingChange={(scrubbing) => setScrubbing(scrubbing)}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<MotionReviewTimeline
|
|
|
|
segmentDuration={30}
|
|
|
|
timestampSpread={15}
|
|
|
|
timelineStart={timeRange.end}
|
|
|
|
timelineEnd={timeRange.start}
|
|
|
|
showHandlebar
|
|
|
|
handlebarTime={currentTime}
|
|
|
|
setHandlebarTime={setCurrentTime}
|
2024-03-12 18:08:31 +01:00
|
|
|
events={mainCameraReviewItems}
|
2024-03-05 20:55:44 +01:00
|
|
|
motion_events={motionData ?? []}
|
|
|
|
severityType={severity}
|
|
|
|
contentRef={contentRef}
|
|
|
|
onHandlebarDraggingChange={(scrubbing) => setScrubbing(scrubbing)}
|
|
|
|
/>
|
|
|
|
)}
|
2024-02-23 01:03:34 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|