Skip to content

No way to load paused: load() unconditionally autostarts, so a host mounting into a hold (synced start, resume prompt) always eats one engine-initiated resume #124

Closed

Description

@rrgomes

We mount media paused in two flows: a synchronized-start lobby (several devices load the same item, hold at a shared offset, and start together on a signal) and hold-at-mount UX. The engine can't express that mount: every load path ends in an unconditional autostart, so a host holding a pause always gets one engine-initiated .playing at load-completion and has to claw it back.

Device traces (5.0.3, tvOS 26.5). Three mount-time events in one evening, same shape — standing host pause intent, load-completion declares .playing, our state sink re-asserts. Solo start (HLG episode, engine-native route), where the host's play command only lands after load() returns, so the internal autostart wins the race:

03:20:40.243 [NativeAVPlayerHost] #2 timeControlStatus=playing reason=- t+0.36s
03:20:40.248 [VM] engine auto-resume suppressed (transport intent = pause) — re-asserting pause
03:20:40.286 [host] startPlayback autoplay=true   <- host play intent lands 38 ms after the clamp

Synced-start originate (04:26:27.638) and join (04:27:03.885) show the same suppression against a lobby hold.

Code read (5.0.4). The VOD load tail runs nativeHost?.play() (or runStartupReadinessGate, which calls play() itself) then an unconditional state = .playing; the lean nativeRemoteHLS bypass self-starts too ("VOD path triggers play() at the tail of load(); this lean path early-returns, so self-start here"). LoadOptions has no autoplay field. A pre-load pause() can't express it either: the item swap clears playIntent ("Clear playIntent so the previous session can't restart the next item at ITS readyToPlay") and the load tail's play() then sets it true. The settle-paused mechanism already exists — wireCommonHostSinks(isReady:) flips .loading -> .paused at readiness — and the main load passes isReady: nil only because autostart already ran.

Ask: LoadOptions.autoplay: Bool = true. With false: skip the terminal play() (and the readiness gate's), leave playIntent false, and let the existing readiness waypoint settle .loading -> .paused. Default true keeps every current host byte-identical. This is the same declared-vs-real family as #122/#123: at a paused mount today, the declared .playing has no host play() behind it and transportIntentIsPlaying reads false throughout — the two published truths disagree at every paused mount.

Workaround today (why this is low-urgency): a host state-sink clamp re-asserts pause() on any declared .playing without standing host intent. It works, but it's racy by construction — the engine runs at rate 1 for the sink round-trip, and on solo starts the clamp briefly pauses a legitimate startup until the host's own play lands. An honest paused mount removes the class.

Activity

  1. superuser404notfound commented on Jul 14, 2026

    @superuser404notfound
    Owner

    Shipped in 5.0.5: https://github.com/superuser404notfound/AetherEngine/releases/tag/5.0.5

    LoadOptions.autoplay (default true, so existing loads are byte-identical). Set it to false to mount paused: the load skips its terminal play() and state = .playing across every path (native VOD, software, both audio backends, and the lean native remote-HLS path), leaves playIntent false, and settles .loading to .paused through the existing host.$isReady waypoint. The host resumes on the shared signal with play(). On the native VOD path the SDR-to-HDR cold-start readiness gate is skipped for a paused mount, since it plays to poll readiness; a paused mount that would need it resumes via the later play().

    One scope note for the synced-start lobby: this covers the initial load. reloadAtCurrentPosition (audio switch, live rejoin) still resumes playing, so a track switch during the hold would start it. Preserving a paused hold across a reload is the transport-intent-durability family (#122) rather than load-time autostart; if the lobby needs it, say so and it can go there.

    Leaving this open until you have confirmed the paused mount settles cleanly on your rig and fits the synced-start flow.

  2. rrgomes commented on Jul 17, 2026

    @rrgomes
    ContributorAuthor

    Adopted in our fork against 5.5.1: our synchronized-start mounts now load with autoplay: false, the engine settles .loading -> .paused exactly as documented, and the mount no longer eats an engine-initiated resume (the transport-intent clamp we keep as a backstop has gone quiet at mount time). We picked up isSessionReady from 5.1.0 in the same pass for our readiness gating. From our side #124 can close. Thanks for shipping both.

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