You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Seek on the loopback-HLS native path resolves clock + state before the seek lands → reported time bounces back through the pre-seek position #37
On the native (loopback-HLS) VOD path, a seek momentarily reports the target time, then bounces back to the pre-seek position for one or more clock ticks before finally settling at the target when the AVPlayer seek physically lands.
Concrete trace from a backward seek: playhead at 97012 ms → seek to 29345 ms → clock reads 29345 briefly → bounces to 97012 → re-lands at 29345.
Expected: once a seek begins, the reported time moves toward the target and stays there — it should never read the pre-seek position again.
Steps to reproduce
engine.load(url:) a VOD item that routes to the Native AVPlayer / loopback-HLS path (e.g. HEVC or H.264 in MKV).
Let it play to ~97 s.
engine.seek(to: 29.3) (or scrub backward via the transport bar).
Observe AetherClock.currentTime (or the scrub bar): it shows ~29.3 s, snaps back to ~97 s, then returns to ~29.3 s when the seek lands.
Likely mechanism (FWIW — you know the internals best)
seek(to:) calls the native host seek fire-and-forget, then immediately writes clock.currentTime = target and state = .playing (the "optimistically flip back to .playing so the host UI doesn't stick on .seeking" path). On the loopback-HLS source the AVPlayer seek lands multiple seconds later, so the 100 ms addPeriodicTimeObserver reads avPlayer.currentTime (still pre-seek) and overwrites the optimistic value until the seek completes.
Fix direction: await the host seek's completion (the AVPlayer seek(to:completionHandler:) callback) before writing the post-seek clock/state, so .seeking spans the real landing. I have a WIP that does exactly this for the programmatic path — happy to describe it; the same change also enables an accurate in-flight seek signal (filed separately as a capability request, linked below).
Environment
AetherEngine: 3.5.0 / dec30dc
Host app: Custom / my own integration (a custom tvOS client)
Platform: tvOS
OS version: tvOS 26.x
Device / chip: Apple TV 4K (3rd gen, 2022) and (2nd gen, 2021)
Playback path: Native AVPlayer
Source media
Not codec-specific — reproduces with any HEVC / H.264 VOD that takes the loopback-HLS native path; it's a seek-resolution timing issue rather than a decode bug. ffprobe output and a sample available on request.
Error codes / log lines
None — no CoreMedia / AVPlayer / VideoToolbox error is raised. The clock simply bounces through the pre-seek position before settling.
Related
#38 — capability request: expose an accurate in-flight seek signal (isSeeking / seekTarget). The same await-the-landing fix enables it.
Fixed on main (commit 924951e, currently under [Unreleased]).
Your mechanism analysis was exactly right: seek(to:) drove the native host fire-and-forget, wrote the target clock optimistically, and flipped state back to .playing, so the 100 ms addPeriodicTimeObserver overwrote the optimistic value with AVPlayer's still-pre-seek clock until the loopback seek physically landed.
What changed:
NativeAVPlayerHost.seek is now async and resolves on AVPlayer's seek(to:completionHandler:) callback.
While a seek is in flight the periodic observer suppresses its stale currentTime publishing, so the clock holds the target across the landing instead of bouncing.
seek(to:) awaits that landing before flipping back to .playing.
Verified off-device with an extended aetherctl seektest probe (a concurrent 20 ms sampler across a single backward seek): no bounce through the pre-seek position. Disabling the suppression flips the probe to FAIL on the same source, confirming it detects the exact bug. The definitive confirmation is latency-dependent (real loopback / slow source / device), so a retest against your repro would be appreciated once it rides the next release.
Thanks for the precise writeup, it made the fix straightforward.
Activity
DrHurt commentedon Jun 16, 2026
I think I’ve also seen this happen with Sodalite!
fix(seek): await the real loopback-HLS landing + publish isSeeking/se…
superuser404notfound commentedon Jun 16, 2026
Fixed on
main(commit924951e, currently under[Unreleased]).Your mechanism analysis was exactly right:
seek(to:)drove the native host fire-and-forget, wrote the target clock optimistically, and flipped state back to.playing, so the 100 msaddPeriodicTimeObserveroverwrote the optimistic value with AVPlayer's still-pre-seek clock until the loopback seek physically landed.What changed:
NativeAVPlayerHost.seekis nowasyncand resolves on AVPlayer'sseek(to:completionHandler:)callback.currentTimepublishing, so the clock holds the target across the landing instead of bouncing.seekGenerationguard lets a superseding scrub own the final state (AVPlayer reports the abandoned seekfinished == false, which is also the rapid-seek coalescing case from Loopback-HLS playback wedges under rapid repeated seeks; recovered clock diverges from the decoded frame #35).seek(to:)awaits that landing before flipping back to.playing.Verified off-device with an extended
aetherctl seektestprobe (a concurrent 20 ms sampler across a single backward seek): no bounce through the pre-seek position. Disabling the suppression flips the probe to FAIL on the same source, confirming it detects the exact bug. The definitive confirmation is latency-dependent (real loopback / slow source / device), so a retest against your repro would be appreciated once it rides the next release.Thanks for the precise writeup, it made the fix straightforward.
fix(player): track rendered frame in sourceTime so subtitles follow t…
fix(hls): never 404 an in-range loopback segment; re-assert orphaned …
fix(video): break the loopback-HLS VOD scrub-burst livelock (superuse…
fix(player): aim stall recovery at the requested seek target, not the…
fix(subtitles): re-anchor the overlay subtitle reader after a wedged …
fix(clock): hold the scrub clock through a wedged-restart recovery (#37…
feat(audio): the Flash tail routes through the bridge instead of goin…
fix(cli): seektest reads its counters under the handler lock and exit…