mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 22:55:26 +03:00
Fix reloading recordings failing
This commit is contained in:
parent
63984c1bc9
commit
daa6d7672c
@ -168,7 +168,10 @@ export default function DynamicVideoPlayer({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!controller || !recordings) {
|
if (!controller || !recordings) {
|
||||||
|
if (recordings?.length == 0) {
|
||||||
setNoRecording(true);
|
setNoRecording(true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -101,7 +101,7 @@ export default function Events() {
|
|||||||
|
|
||||||
// review paging
|
// review paging
|
||||||
|
|
||||||
const [beforeTs, setBeforeTs] = useState(Date.now() / 1000);
|
const [beforeTs, setBeforeTs] = useState(Math.ceil(Date.now() / 1000));
|
||||||
const last24Hours = useMemo(() => {
|
const last24Hours = useMemo(() => {
|
||||||
return { before: beforeTs, after: getHoursAgo(24) };
|
return { before: beforeTs, after: getHoursAgo(24) };
|
||||||
}, [beforeTs]);
|
}, [beforeTs]);
|
||||||
@ -455,5 +455,5 @@ export default function Events() {
|
|||||||
function getHoursAgo(hours: number): number {
|
function getHoursAgo(hours: number): number {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
now.setHours(now.getHours() - hours);
|
now.setHours(now.getHours() - hours);
|
||||||
return now.getTime() / 1000;
|
return Math.ceil(now.getTime() / 1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,7 @@ import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
|
|||||||
import { useResizeObserver } from "@/hooks/resize-observer";
|
import { useResizeObserver } from "@/hooks/resize-observer";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { useFullscreen } from "@/hooks/use-fullscreen";
|
import { useFullscreen } from "@/hooks/use-fullscreen";
|
||||||
|
import ActivityIndicator from "@/components/indicators/activity-indicator";
|
||||||
|
|
||||||
const SEGMENT_DURATION = 30;
|
const SEGMENT_DURATION = 30;
|
||||||
|
|
||||||
@ -107,7 +108,7 @@ export function RecordingView({
|
|||||||
return chunk.after <= startTime && chunk.before >= startTime;
|
return chunk.after <= startTime && chunk.before >= startTime;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const currentTimeRange = useMemo(
|
const currentTimeRange = useMemo<TimeRange | undefined>(
|
||||||
() => chunkedTimeRange[selectedRangeIdx],
|
() => chunkedTimeRange[selectedRangeIdx],
|
||||||
[selectedRangeIdx, chunkedTimeRange],
|
[selectedRangeIdx, chunkedTimeRange],
|
||||||
);
|
);
|
||||||
@ -171,6 +172,10 @@ export function RecordingView({
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!currentTimeRange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (scrubbing || exportRange) {
|
if (scrubbing || exportRange) {
|
||||||
if (
|
if (
|
||||||
currentTime > currentTimeRange.before + 60 ||
|
currentTime > currentTimeRange.before + 60 ||
|
||||||
@ -198,6 +203,10 @@ export function RecordingView({
|
|||||||
|
|
||||||
const manuallySetCurrentTime = useCallback(
|
const manuallySetCurrentTime = useCallback(
|
||||||
(time: number) => {
|
(time: number) => {
|
||||||
|
if (!currentTimeRange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setCurrentTime(time);
|
setCurrentTime(time);
|
||||||
|
|
||||||
if (currentTimeRange.after <= time && currentTimeRange.before >= time) {
|
if (currentTimeRange.after <= time && currentTimeRange.before >= time) {
|
||||||
@ -210,6 +219,10 @@ export function RecordingView({
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!currentTimeRange) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!scrubbing) {
|
if (!scrubbing) {
|
||||||
if (Math.abs(currentTime - playerTime) > 10) {
|
if (Math.abs(currentTime - playerTime) > 10) {
|
||||||
if (
|
if (
|
||||||
@ -471,6 +484,7 @@ export function RecordingView({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{currentTimeRange ? (
|
||||||
<div
|
<div
|
||||||
ref={mainLayoutRef}
|
ref={mainLayoutRef}
|
||||||
className={cn(
|
className={cn(
|
||||||
@ -596,7 +610,8 @@ export function RecordingView({
|
|||||||
contentRef={contentRef}
|
contentRef={contentRef}
|
||||||
mainCamera={mainCamera}
|
mainCamera={mainCamera}
|
||||||
timelineType={
|
timelineType={
|
||||||
(exportRange == undefined ? timelineType : "timeline") ?? "timeline"
|
(exportRange == undefined ? timelineType : "timeline") ??
|
||||||
|
"timeline"
|
||||||
}
|
}
|
||||||
timeRange={timeRange}
|
timeRange={timeRange}
|
||||||
mainCameraReviewItems={mainCameraReviewItems}
|
mainCameraReviewItems={mainCameraReviewItems}
|
||||||
@ -608,6 +623,13 @@ export function RecordingView({
|
|||||||
setExportRange={setExportRange}
|
setExportRange={setExportRange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="relative size-full">
|
||||||
|
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||||
|
No recordings or previews found for this time
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user