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}
|
videoRef={videoRef}
|
||||||
currentSource={{
|
currentSource={{
|
||||||
playlist: source,
|
playlist: source,
|
||||||
startPosition: 0,
|
|
||||||
}}
|
}}
|
||||||
hotKeys
|
hotKeys
|
||||||
visible
|
visible
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const unsupportedErrorCodes = [
|
|||||||
|
|
||||||
export interface HlsSource {
|
export interface HlsSource {
|
||||||
playlist: string;
|
playlist: string;
|
||||||
startPosition: number;
|
startPosition?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
type HlsVideoPlayerProps = {
|
type HlsVideoPlayerProps = {
|
||||||
|
|||||||
@ -185,16 +185,26 @@ export default function DynamicVideoPlayer({
|
|||||||
playerRef.current.autoplay = !isScrubbing;
|
playerRef.current.autoplay = !isScrubbing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let startPosition = undefined;
|
||||||
|
|
||||||
|
if (startTimestamp) {
|
||||||
const inpointOffset = calculateInpointOffset(
|
const inpointOffset = calculateInpointOffset(
|
||||||
recordingParams.after,
|
recordingParams.after,
|
||||||
(recordings || [])[0],
|
(recordings || [])[0],
|
||||||
);
|
);
|
||||||
|
const idealStartPosition = Math.max(
|
||||||
|
0,
|
||||||
|
startTimestamp - timeRange.after - inpointOffset,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (idealStartPosition >= recordings[0].start_time - timeRange.after) {
|
||||||
|
startPosition = idealStartPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setSource({
|
setSource({
|
||||||
playlist: `${apiHost}vod/${camera}/start/${recordingParams.after}/end/${recordingParams.before}/master.m3u8`,
|
playlist: `${apiHost}vod/${camera}/start/${recordingParams.after}/end/${recordingParams.before}/master.m3u8`,
|
||||||
startPosition: startTimestamp
|
startPosition,
|
||||||
? Math.max(0, startTimestamp - timeRange.after - inpointOffset)
|
|
||||||
: 0,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setLoadingTimeout(setTimeout(() => setIsLoading(true), 1000));
|
setLoadingTimeout(setTimeout(() => setIsLoading(true), 1000));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user