Repository navigation
fix(macos): seek HLS streams exactly - #260
Open
comprido96 wants to merge 1 commit into
Open
comprido96 wants to merge 1 commit into
comprido96 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS,
seekToseeks 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-DISCONTINUITYbetween 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
seekTolines 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