Repository navigation
fix(macos): show the current frame of a paused HLS stream - #261
Open
comprido96 wants to merge 1 commit into
Open
comprido96 wants to merge 1 commit into
comprido96 wants to merge 1 commit into
Conversation
AVPlayerItemVideoOutput only delivers frames while the timer pulls them during playback, and the paused-frame captures in pause(), seekTo() and at open were all skipped for HLS. A paused HLS video therefore kept a stale frame after a seek, and an HLS media opened paused showed nothing at all. - pause(), a landed seek while paused, and an HLS item turning readyToPlay while paused capture the frame at the current time. The output decodes it asynchronously, so the capture polls for up to a second. - The native side counts retained frames (getFrameGeneration). While paused, MacVideoPlayerState re-arms its one-shot thumbnail read when the count changes: the frame of a paused seek lands after the producer has already spent that read on the previous frame. Non-HLS media keep their existing path. 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, a paused HLS video never updates its picture:
pause(), a seek while paused andcaptureInitialFrame()all skip HLS (!isHLSStream), and frames are only pulled by the capture timer while playing;InitialPlayerState.PAUSEshows nothing.Fix
pause(), a seek that lands while paused (seek completion handler), and the item turningreadyToPlaywhile paused callcapturePausedFrame(), which copies the frame at the current time.AVPlayerItemVideoOutputdecodes it asynchronously after a seek or an open, so the capture polls every 20 ms for up to a second. Non-HLS media keep their existing path.getFrameGeneration,nGetFrameGeneration) incremented on every retained frame.MacVideoPlayerState): while paused,waitForPlaybackStatere-arms its one-shot thumbnail read when the counter changes. Without it the paused producer spends that read right after the seek, on the old frame, and never sees the new one.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.NativeVideoPlayer.swift, callingMacVideoPlayerwith the same sequence the Kotlin layer uses. After each of 4 paused seeks the retained frame changes (before: never), and a media opened paused has a frame.:mediaplayer:jvmJar(Swift build included) passes.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