fix(player): restart backward HLS seeks (#499)

Preserve negative player-time offsets for targets before a copy-mode HLS window so the existing transcode restart path handles them.

Co-authored-by: GPT-5.6 Sol <noreply@openai.com>
This commit is contained in:
Quick
2026-07-27 16:23:45 -04:00
committed by GitHub
co-authored by GPT-5.6 Sol
parent f235524365
commit 1a784a1cdf
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ describe("toMediaTime / toPlayerTime", () => {
expect(toPlayerTime(3060, 3000)).toBe(60);
});
it("never returns a negative time", () => {
it("preserves an out-of-window target before the stream origin", () => {
expect(toMediaTime(-10, 0)).toBe(0);
expect(toPlayerTime(10, 3000)).toBe(0);
expect(toPlayerTime(10, 3000)).toBe(-2990);
});
});
+3 -1
View File
@@ -3,7 +3,9 @@ export function toMediaTime(playerTimeSeconds: number, streamOriginSeconds = 0):
}
export function toPlayerTime(mediaTimeSeconds: number, streamOriginSeconds = 0): number {
return Math.max(0, mediaTimeSeconds - streamOriginSeconds);
// Preserve negative offsets so callers can distinguish a target before the
// current HLS window from the locally seekable position at zero.
return mediaTimeSeconds - streamOriginSeconds;
}
/**