Skip to content

fix(airplay): the remote-HLS bypass reloads when it stands on its own origin (#316) - #352

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/316-airplay-route-change-on-subtitle-proxy
Aug 9, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/316-airplay-route-change-on-subtitle-proxy

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

What

The wireless-AirPlay route change (#86, #227) reloads the session so the playback URL is re-resolved onto the device's LAN IP. It excluded the nativeRemoteHLS bypass wholesale:

guard playbackBackend == .native, !loadedOptions.nativeRemoteHLS, loadedURL != nil else { return }

on the premise stated right above it, "remote-HLS is already receiver-reachable". That was true while the bypass could only ever play the origin URL.

Why it is no longer true

#316 gave the bypass a second shape. With text sidecars declared at load, it plays a master the engine serves from its own loopback origin, and 127.0.0.1 means nothing on a receiver. Engaging AirPlay mid-playback handed the receiver an address it cannot fetch.

Nothing caught it downstream either: handleRefusedAirPlayMaster requires a nativeVideoSession, which this bypass never builds, so the progress watchdog and its media-playlist fallback both sit out. The result is the silent park documented in AirPlayPlaylistDecision: no -11868, no failed item.

Mounting the proxy while already AirPlaying was covered (AetherEngine+Loading.swift:381). The route change afterwards was not, and the comment at that site claiming "the route-change reload re-enters this path and re-resolves it" was describing a reload that never ran for this path.

The change

The discriminator is not the backend, it is where the session's playback URL points. That goes into AirPlayPlaylistDecision as a pure function, matching the existing offline-testable gates in that file:

static func routeChangeNeedsReload(isRemoteHLSBypass: Bool,
                                   bypassServesLoopbackOrigin: Bool) -> Bool

Both edges reload, matching the loopback path: engaging swaps in the LAN IP, ending puts the session back on the loopback rather than leaving it depending on a LAN address that outlives the receiver.

The reload itself already works on this path, it was only never started. Verified by reading the two preconditions it depends on:

  • load() seats the carryover registry at the Select external subtitles to make them appear in engine.$subtitleTracks. #88 registration point (AetherEngine.swift:2520), which runs before the bypass branch, so prepareRemoteHLSSubtitleProxy sees the sidecars again and remounts the proxy.
  • loadedURL holds the origin URL (AetherEngine.swift:2440), not the proxy URL, so the reload re-enters at the origin instead of treating the loopback master as its source.

Tests

Three cases added to AirPlayPlaylistDecisionTests, red before the change (no such member), green after. Full suite: 1658 tests, 243 suites, passing.

Not covered here

The device half. This is the same boundary as #316 itself: what a receiver does with the swapped URL cannot be observed headless. The reporter's PiP/AirPlay/wired-display pass is what would confirm it.

Refs #316.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE

… origin (#316)

The wireless-AirPlay route change reloads the session so the playback URL is
re-resolved onto the device's LAN IP, and it excluded the nativeRemoteHLS bypass
wholesale on the premise that remote HLS is already receiver-reachable. That held
while the bypass could only play the origin URL.

#316 gave it a second shape. With text sidecars declared at load, the bypass plays
a master the engine serves from its own loopback origin, and 127.0.0.1 means
nothing on a receiver. Engaging AirPlay mid-playback therefore handed the receiver
an address it cannot fetch, and nothing caught it: handleRefusedAirPlayMaster wants
a nativeVideoSession, which this bypass does not build, so there was no watchdog and
no fallback either, just the silent park the receiver does for a manifest it will
not take.

Mounting the proxy while already AirPlaying was covered; the route change afterwards
was not, and the comment there claiming the route-change reload re-resolves this
path was describing a reload that never ran for it.

So the discriminator is not the backend, it is where the playback URL points. Both
edges reload, matching the loopback path: engaging swaps in the LAN IP, ending puts
the session back on the loopback instead of leaving it depending on a LAN address
that outlives the receiver. The reload works on this path already, it was only never
started: load() seats the carryover registry before the bypass branch, so the proxy
is rebuilt, and loadedURL holds the origin, not the proxy URL.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
@superuser404notfound
superuser404notfound merged commit e1f7b44 into main Aug 9, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the fix/316-airplay-route-change-on-subtitle-proxy branch August 9, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant