mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-27 09:07:41 +03:00
Don't set start position if it is not valid
This commit is contained in:
parent
ea9e98ab78
commit
e58c02aa0e
@ -109,7 +109,6 @@ export function GenericVideoPlayer({
|
||||
videoRef={videoRef}
|
||||
currentSource={{
|
||||
playlist: source,
|
||||
startPosition: 0,
|
||||
}}
|
||||
hotKeys
|
||||
visible
|
||||
|
||||
@ -30,7 +30,7 @@ const unsupportedErrorCodes = [
|
||||
|
||||
export interface HlsSource {
|
||||
playlist: string;
|
||||
startPosition: number;
|
||||
startPosition?: number;
|
||||
}
|
||||
|
||||
type HlsVideoPlayerProps = {
|
||||
|
||||
@ -185,16 +185,26 @@ export default function DynamicVideoPlayer({
|
||||
playerRef.current.autoplay = !isScrubbing;
|
||||
}
|
||||
|
||||
const inpointOffset = calculateInpointOffset(
|
||||
recordingParams.after,
|
||||
(recordings || [])[0],
|
||||
);
|
||||
let startPosition = undefined;
|
||||
|
||||
if (startTimestamp) {
|
||||
const inpointOffset = calculateInpointOffset(
|
||||
recordingParams.after,
|
||||
(recordings || [])[0],
|
||||
);
|
||||
const idealStartPosition = Math.max(
|
||||
0,
|
||||
startTimestamp - timeRange.after - inpointOffset,
|
||||
);
|
||||
|
||||
if (idealStartPosition >= recordings[0].start_time - timeRange.after) {
|
||||
startPosition = idealStartPosition;
|
||||
}
|
||||
}
|
||||
|
||||
setSource({
|
||||
playlist: `${apiHost}vod/${camera}/start/${recordingParams.after}/end/${recordingParams.before}/master.m3u8`,
|
||||
startPosition: startTimestamp
|
||||
? Math.max(0, startTimestamp - timeRange.after - inpointOffset)
|
||||
: 0,
|
||||
startPosition,
|
||||
});
|
||||
|
||||
setLoadingTimeout(setTimeout(() => setIsLoading(true), 1000));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user