Skip to content

fix(macos): seek HLS streams exactly - #260

Open
comprido96 wants to merge 1 commit into
kdroidFilter:masterfrom
comprido96:fix/macos-hls-exact-seek
Open

comprido96 wants to merge 1 commit into
kdroidFilter:masterfrom
comprido96:fix/macos-hls-exact-seek

Conversation

@comprido96

@comprido96 comprido96 commented Oct 30, 2026 •

Copy link
Copy Markdown

Problem

On macOS, seekTo seeks HLS streams with a fixed ±1 s tolerance (NativeVideoPlayer.swift), so AVPlayer lands on the nearest keyframe. With a 2 s GOP the position ends up to a second away from where the user dropped the slider: measured −1.001 s, −1.000 s, −0.747 s on targets away from a keyframe.

Fix

Seek HLS with toleranceBefore: .zero, toleranceAfter: .zero.

Testing

Tested on macOS 26 (Apple Silicon), against Frigate 0.17 HLS VOD clips (fMP4 segments, EXT-X-DISCONTINUITY between segments, keyframes every 2 s) from two cameras: H.264 Baseline 1280×720 25 fps, and H.264 High 2560×1920 ~30 fps VFR with AAC. Five seeks at random positions per camera, position read 3 s later: error ≤ 2 ms on every seek (before: up to 1.0 s). No visible change in seek latency on these clips.

Note: #261 (paused HLS frame) touches the same seekTo lines as this PR; whichever lands second needs a trivial rebase, which I will do.


Prepared with an AI coding assistant (Claude Code) while integrating the library into a macOS desktop app, and tested as described above. Happy to adjust, split or drop anything that does not fit the project.

🤖 Generated with Claude Code

The HLS branch of seekTo used a fixed ±1 s tolerance, so AVPlayer landed on
the nearest keyframe: with a 2 s GOP the position ended up to a second away
from the requested time, and a scrubber jumped back after every drag.
Seek with zero tolerance before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants