mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-28 05:28:58 +03:00
Fix HLS jumping to end of timeChunk (#20982)
* Fix HLS jumping to end * Undo
This commit is contained in:
@@ -135,6 +135,23 @@ export default function HlsVideoPlayer({
|
||||
if (!useHlsCompat) {
|
||||
videoRef.current.src = currentSource.playlist;
|
||||
videoRef.current.load();
|
||||
// For native HLS, we need to seek after metadata loads since startPosition isn't supported
|
||||
if (currentSource.startPosition !== undefined) {
|
||||
videoRef.current.addEventListener(
|
||||
"loadedmetadata",
|
||||
() => {
|
||||
if (videoRef.current && currentSource.startPosition !== undefined) {
|
||||
// Clamp startPosition to video duration to prevent seeking beyond the end
|
||||
const clampedPosition = Math.min(
|
||||
currentSource.startPosition,
|
||||
videoRef.current.duration || Infinity,
|
||||
);
|
||||
videoRef.current.currentTime = clampedPosition;
|
||||
}
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user