Skip to content

Seek issued while paused re-engages playback (declared .playing + underlying player rate=1) instead of landing paused #122

Closed

Description

@rrgomes

Environment: 5.0.2 (d5aadc9) via SPM; tvOS 26.5; Apple TV 4K 2021 (AppleTV11,1); loopback-HLS native path (NativeAVPlayerHost); origin = local Plex Media Server over wired gigabit LAN. Asset in the traces: 4K HEVC Dolby Vision P7 film, 7080 s, FLAC + AC3 audio, PGS subtitles on. Not asset-specific as far as we can tell — we have earlier instances of the same shape on other titles.

Behavior: with playback paused by the host (declared state .paused, underlying player rate=0.0 / timeControlStatus=paused), issuing a seek — a ±10 s skip, a skip burst, or a scrub commit — re-engages playback with no host play() call. Three trigger points observed:

  1. At seek finalization. The seek lands, paused is re-established for a few ms, then the declared state flips to .playing and the underlying player itself starts (timeControlStatus=playing) — real playback resume, not just a state-label artifact.
  2. At seek target declaration. On queued skip bursts the flip can arrive within ~2-4 ms of the next seek call, same millisecond as declareTarget.
  3. During post-storm settle / stall recovery. Before we clamped host-side, a single pause issued during a long multi-seek settle produced seven autonomous rate=1.0 re-engagements over 35 s (2026-07-12 04:32:43-04:33:17 UTC window, available on request) — the engine kept re-asserting play until the settle finished.

Solo repro (single device, no sync layer, nothing else driving the player): play → pause → skip back/forward or scrub while paused → playback resumes on the landing. In a 66 s test segment every one of 8 pauses interleaved with seeks was re-engaged, each within ~1 s of seek activity (target declaration, landing, or scrub commit). A plain pause with no seek in flight is never re-engaged — this is specifically seek handling.

Trace (timestamps UTC, wrapper tags trimmed; [host] = our app. Our workaround re-asserts pause whenever the declared state contradicts the host's standing transport intent, which is why each flip is followed by an immediate rate=0.0):

15:28:37.266 [NativeAVPlayerHost] #2 rate=0.0
15:28:37.266 [NativeAVPlayerHost] #2 timeControlStatus=paused reason=- t+36.28s   <- seek landed, paused
15:28:37.271 [NativeAVPlayerHost] #2 timeControlStatus=playing reason=- t+36.29s  <- engine re-engages, no host play()
15:28:37.273 [host] engine auto-resume suppressed (transport intent = pause) — re-asserting pause
15:28:37.273 [NativeAVPlayerHost] #2 rate=0.0
...
15:28:39.956 [remote] skip-back press (still paused)
15:28:40.133 [host] seek -> 119.0s
15:28:40.146 [HLSVideoEngine] declareTarget backward jump 33 -> 29: resident in cache, no restart
15:28:40.205 [remote] skip-back press
15:28:40.388 [host] seek -> 109.0s
15:28:40.390 [host] engine auto-resume suppressed (transport intent = pause) — re-asserting pause  <- flip at declaration
15:28:40.391 [NativeAVPlayerHost] #2 rate=0.0

Scrub-commit variant, same segment:

15:29:06.196 [HLSVideoEngine] declareTarget backward jump 34 -> 26: resident in cache, no restart
15:29:06.426 [host] seek (scrub commit) -> 106.915s
15:29:06.430 [host] engine auto-resume suppressed (transport intent = pause) — re-asserting pause

Expected: a seek preserves the transport intent in effect when it was issued — paused seeks land paused, presenting the new frame (AVPlayer.seek(to:) at rate=0 semantics). If internal resume points (finalize, stall nudge, rebuild completion) need rate=1 transiently, restore the prior intent afterwards. Alternatively (or additionally): expose a host-visible transport-intent property distinct from the transient state machine, so hosts can tell an engine-internal resume from a real one without heuristics.

Impact: pause-then-skip is a core tvOS remote pattern, so any host inherits spontaneous resume; in multi-device synced playback (where we first saw it) each re-engagement propagates as a phantom group-wide resume. Our intent-clamp workaround holds, but it is a workaround — it re-asserts pause after the underlying player has already started for a frame or two.

Happy to run any drill or capture deeper traces.

Activity

  1. added a commit that references this issue on Jul 12, 2026
  2. superuser404notfound commented on Jul 12, 2026

    @superuser404notfound
    Owner

    Root cause found and fixed, released in 5.0.3.

    Your three trigger points were one defect. The normal seek finalize set state = .playing unconditionally, regardless of the transport intent in effect when the seek was issued. On its own that reported playing after a paused scrub, but the resume itself came from the #93 stall-recovery reassert: a backward skip's rebuffer opens the 30s recovery window, and the seek's own paused landing (timeControlStatus == .paused) then arrives while state == .playing, so shouldReassertPlayDuringRecovery (which keys on state == .playing, not on any user-pause flag) misreads it as a spurious pause and calls host.play(). That is why the flip lands within milliseconds of seek activity (finalize, target declaration, or a post-storm settle) and why a plain pause with no seek in flight is never touched, exactly as you observed. The declareTarget ... resident in cache, no restart path carries no transport call; it was the seek driving it whose finalize flipped the state.

    Fix (main, 5.0.3): the finalize now derives its state from the durable transport intent (the native host's playIntent, which a seek never touches) instead of forcing .playing. A paused scrub lands paused and presents the new frame, and engineStateIsPlaying stays honest so the reassert only fires on a genuine stall during real playback. A playing scrub is unchanged.

    Retest ask, 5.0.3, same drill: play, pause, then skip back/forward or scrub-commit while paused, both solo and in bursts. Expected: the player stays paused on the landing (new frame shown), no autonomous rate=1 re-engage, and your intent-clamp workaround should stop seeing the flip to .playing to re-assert against. If you want to confirm from the engine side, the seek's landing should leave the declared state .paused.

    Honest scope: this fixes the reassert path, which is what your traces show. One related path is deliberately separate and not in this repro: an established-playback item-death confirmed while paused can still revive and resume via reloadStalledConsumerItem(allowPausedConsumer: true). If you ever hit a paused re-engage that is NOT tied to a seek landing, that would be the one to flag, and it deserves its own trace.

  3. rrgomes commented on Jul 13, 2026

    @rrgomes
    ContributorAuthor

    Confirmed fixed on 5.0.3 (312c809), same drill. Solo on a 2017 Apple TV 4K (the slowest device we run): play, pause, then ~10 backward/forward skips and scrub-commits over ~75s while paused — every landing stayed paused presenting the new frame, zero autonomous rate=1 re-engagements. The first rate=1.0 in the trace is the user's own resume press, 30.6s after the last landing had settled paused. Across a full evening matrix on four devices (storms included), our intent-clamp never fired on a seek; the only three clamp events all night were load/mount-time (fresh session start and two sync-session mounts) — consistent with your honest-scope note that load-completion is a separate path. We'll trace whether our own load options are responsible for those before bothering you with them; as clamped they're benign. Thanks for the same-day root-cause and fix — closing loop from our side, feel free to close the issue.

  4. superuser404notfound commented on Jul 13, 2026

    @superuser404notfound
    Owner

    Thanks for the thorough same-drill retest, and especially for running it on the 2017 Apple TV 4K, the slowest device in the fleet. The evidence is exactly what the fix predicted: every paused landing stayed paused presenting the new frame, zero autonomous rate=1 re-engagements, and the only rate=1.0 in the trace being the user's own resume press 30.6s after the last landing settled. Closing as fixed in 5.0.3 (312c809).

    On the three load/mount-time clamp events: those are the separate load-completion path from the honest-scope note, benign as clamped. If your own load-options trace ends up pointing back at the engine, open a fresh issue with the phase log and I will take a look. Same for the latent item-death-in-pause revive path, if it ever shows up untied to a seek landing that is the one to flag. Appreciate the closed-loop confirmation.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions