frigate/web/src/utils/videoUtil.ts
Josh Hawkins 8a143b4284
Fixes (#18304)
* fix recordings check

* Only calculate inpoint offset for beginning of hour segment

* Cleanup

* Fix seeking

* add Czech

* explore i18n fix

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2025-05-19 14:43:22 -06:00

27 lines
777 B
TypeScript

import { Recording } from "@/types/record";
/** the HLS endpoint returns the vod segments with the first
* segment of the hour trimmed, meaning it will start at
* the beginning of the hour, cutting off any difference
* that the segment has.
*/
export function calculateInpointOffset(
timeRangeStart: number | undefined,
firstRecordingSegment: Recording | undefined,
): number {
if (!timeRangeStart || !firstRecordingSegment) {
return 0;
}
// if the first recording segment does not cross over
// the beginning of the time range then there is no offset
if (
firstRecordingSegment.start_time < timeRangeStart &&
firstRecordingSegment.end_time > timeRangeStart
) {
return timeRangeStart - firstRecordingSegment.start_time;
}
return 0;
}