mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-07 22:15:28 +03:00
recording timestamp fix
when startTime is exactly on an hour boundary, findIndex returns the first matching chunk, which is the previous hour's chunk (where before == startTime), instead of the correct chunk (where after == startTime) the bug shows up when using the share timestamp feature and sharing a specific timestamp on the exact hour mark. when accessing the shared link, the timeline would jump to the incorrect hour
This commit is contained in:
parent
8aa1e1b373
commit
9c1fb2e5e9
@ -170,7 +170,7 @@ export function RecordingView({
|
|||||||
);
|
);
|
||||||
const [selectedRangeIdx, setSelectedRangeIdx] = useState(
|
const [selectedRangeIdx, setSelectedRangeIdx] = useState(
|
||||||
chunkedTimeRange.findIndex((chunk) => {
|
chunkedTimeRange.findIndex((chunk) => {
|
||||||
return chunk.after <= startTime && chunk.before >= startTime;
|
return chunk.after <= startTime && chunk.before > startTime;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const currentTimeRange = useMemo<TimeRange>(
|
const currentTimeRange = useMemo<TimeRange>(
|
||||||
@ -275,7 +275,7 @@ export function RecordingView({
|
|||||||
const updateSelectedSegment = useCallback(
|
const updateSelectedSegment = useCallback(
|
||||||
(currentTime: number, updateStartTime: boolean) => {
|
(currentTime: number, updateStartTime: boolean) => {
|
||||||
const index = chunkedTimeRange.findIndex(
|
const index = chunkedTimeRange.findIndex(
|
||||||
(seg) => seg.after <= currentTime && seg.before >= currentTime,
|
(seg) => seg.after <= currentTime && seg.before > currentTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user