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:
@@ -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,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user