mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-02 01:51:14 +03:00
fix multi-day seeking
This commit is contained in:
parent
39a678b139
commit
0fbd632875
@ -182,6 +182,7 @@ export default function MotionSearchView({
|
|||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
const [pendingSeekTime, setPendingSeekTime] = useState<number | null>(null);
|
const [pendingSeekTime, setPendingSeekTime] = useState<number | null>(null);
|
||||||
|
const pendingSeekTimeRef = useRef<number | null>(null);
|
||||||
|
|
||||||
// Formatted search window shown above the results (same date+time convention).
|
// Formatted search window shown above the results (same date+time convention).
|
||||||
const formattedSearchRange = useFormattedRange(
|
const formattedSearchRange = useFormattedRange(
|
||||||
@ -642,7 +643,7 @@ export default function MotionSearchView({
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (pendingSeekTime != null) {
|
if (pendingSeekTimeRef.current != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,7 +657,7 @@ export default function MotionSearchView({
|
|||||||
setPlaybackStart(nextTime);
|
setPlaybackStart(nextTime);
|
||||||
setSelectedRangeIdx(index === -1 ? chunkedTimeRange.length - 1 : index);
|
setSelectedRangeIdx(index === -1 ? chunkedTimeRange.length - 1 : index);
|
||||||
mainControllerRef.current?.seekToTimestamp(nextTime, true);
|
mainControllerRef.current?.seekToTimestamp(nextTime, true);
|
||||||
}, [pendingSeekTime, timeRange, chunkedTimeRange]);
|
}, [timeRange, chunkedTimeRange]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!scrubbing) {
|
if (!scrubbing) {
|
||||||
@ -951,6 +952,7 @@ export default function MotionSearchView({
|
|||||||
result.timestamp < timeRange.after ||
|
result.timestamp < timeRange.after ||
|
||||||
result.timestamp > timeRange.before
|
result.timestamp > timeRange.before
|
||||||
) {
|
) {
|
||||||
|
pendingSeekTimeRef.current = result.timestamp;
|
||||||
setPendingSeekTime(result.timestamp);
|
setPendingSeekTime(result.timestamp);
|
||||||
onDaySelect(new Date(result.timestamp * 1000));
|
onDaySelect(new Date(result.timestamp * 1000));
|
||||||
return;
|
return;
|
||||||
@ -972,6 +974,7 @@ export default function MotionSearchView({
|
|||||||
) {
|
) {
|
||||||
manuallySetCurrentTime(pendingSeekTime, true);
|
manuallySetCurrentTime(pendingSeekTime, true);
|
||||||
setPendingSeekTime(null);
|
setPendingSeekTime(null);
|
||||||
|
pendingSeekTimeRef.current = null;
|
||||||
}
|
}
|
||||||
}, [pendingSeekTime, timeRange, manuallySetCurrentTime]);
|
}, [pendingSeekTime, timeRange, manuallySetCurrentTime]);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user