Skip to content

fix(tvos): keep video visible across episode autoplay - #221

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
blurbery:fix/tvos-autoplay-video-handoff
Sep 2, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
blurbery:fix/tvos-autoplay-video-handoff

Conversation

@blurbery

@blurbery blurbery commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

I reproduced the Apple TV autoplay failure again during a real episode handoff: the next episode started, audio played and the playback clock advanced, but the screen stayed black. Backing out and reopening the same episode restored the picture.

The server-side trace rules out a failed stream handoff:

  • The successor session started about 1.1 seconds after the outgoing session ended.
  • It stayed on the expected direct-play route.
  • Media range requests continued returning successfully.
  • The app reported its first-frame signal about 3.7 seconds after the successor started, even though the television still showed black.
  • Playback progress continued for at least 59.7 seconds with audio.
  • There were no authorization, remux, transcode, route-selection, or media-delivery errors around the transition.

I have intentionally left the server address, session identifiers, account details, and viewing history out of this PR.

Root cause

The replacement work already merged in #202 keeps Silo's Aether controller, native host, display criteria, audio-session policy, and playback intent alive across the episode boundary. That part is working as intended, but it exposed one remaining engine-level gap.

On a normal foreground replacement, AetherEngine 6.34.0 still allowed the retained native host to run its ordinary teardown. That path calls replaceCurrentItem(with: nil) before the next item exists. The reused host then performs its normal unload once more before finally attaching the successor.

The Next Up mini-player is relevant because Silo changes presentation at the same time as that nil-item interval. The minimised view is not independently detaching the Aether surface, but the combined mini-player-to-full-screen transition makes the itemless player layer vulnerable to staying black. The countdown, Play Now button, Siri Remote play command, and remote-control next command all converge on playNextEpisodeNow(), so they all hit the same replacement path and showed the same symptom.

Solution

I added a supported one-shot handoff to AetherEngine and arm it from Silo's existing replacement boundary immediately before the outgoing episode is paused:

  1. AetherPlaybackController.prepareForReplacement() invalidates the outgoing Silo load as before.
  2. It calls prepareForItemReplacement() on Aether.
  3. The next engine load() consumes that request exactly once.
  4. For a native-to-native transition, Aether keeps the outgoing AVPlayerItem attached while it prepares the successor.
  5. The successor replaces the outgoing item atomically on the same AVPlayer and player layer.

The dependency is pinned to an exact reviewed revision based directly on Silo's existing AetherEngine 6.34.0 commit. I did not upgrade through the intervening engine releases, because that would mix a broad dependency migration into an isolated playback fix. The public API, package lock, project specification, and LGPL source reference all point to the same exact commit.

I also ported and validated the engine change against current AetherEngine main, without forcing that larger dependency upgrade into this fix. That portable commit is ready for a separate upstream submission: blurbery/AetherEngine@1386a80

Regression coverage

Case Expected behavior Coverage
Foreground native → native episode replacement Keep outgoing item until one atomic successor swap Policy and one-shot lifecycle tests
Countdown autoplay Uses playNextEpisodeNow() and the same prepared replacement Existing shared call path
Play Now / Siri Remote / remote next command Uses the same replacement path as countdown Existing shared call path
First load or outgoing non-native session Consume the request without retaining an incompatible host New non-native consumption test
A later unrelated load Does not inherit an earlier replacement request New consume-exactly-once test
Final stop / backing out Cancels a pending request and performs normal teardown New stop-cancellation test
Active Picture in Picture Existing mandatory handoff remains active with or without a foreground request Expanded PiP policy and lifecycle tests
Silo load identity and playback intent Outgoing epoch invalidated, successor epoch distinct, autoplay intent retained Existing AetherPlaybackBoundaryTests coverage from #202

Proof and measurements

Replacement seam

This is a deterministic operation count through the exact native replacement path, not a wall-clock performance claim:

Native-to-native episode handoff Before After
Explicit replaceCurrentItem(with: nil) calls 2 0
Total AVPlayer item mutations 3 1
Deliberate nil-item interval Present Removed

That removes both explicit nil assignments and reduces item mutations at the seam by 66.7%. More importantly, there is no longer a period where the shared player layer has no item while Silo changes from the Next Up presentation back to full-screen playback.

Automated validation

The exact AetherEngine revision pinned by this PR passed the complete public CI matrix:

  • iOS Simulator build: passed
  • tvOS Simulator build: passed
  • visionOS Simulator build: passed
  • macOS build and tests: passed
  • 1,958 tests in 282 suites: passed in 69.343 seconds
  • Transport probe build: passed

Run: https://github.com/blurbery/AetherEngine/actions/runs/33621069137

The equivalent change against current AetherEngine main also passed its complete platform matrix: https://github.com/blurbery/AetherEngine/actions/runs/33621760009

The Silo branch is one commit ahead of current upstream main, zero commits behind, and changes only the replacement call plus the exact dependency and license pins. It does not bring the production fork's unrelated commits into this PR.

Scope and release check

This does not change the server playback plan, force a transcode, alter the Next Up timing/UI, or change final teardown. It only selects Aether's existing atomic native item-swap mechanism for an explicitly prepared foreground replacement.

The engine behavior, API contract, package resolution, and platform builds are covered here. A final real-device episode transition on the affected Apple TV is still the release acceptance check; I have not described simulator builds as physical-device proof.

AI Disclosure

I orchestrated this change and provided the reproduction, constraints, and acceptance criteria. I used the OpenAI Codex desktop agent harness with gpt-5.6-sol at ultra reasoning for the code investigation, implementation, regression analysis, and validation. No other AI tooling was used.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a659a5bb-8383-46b2-ad97-88a0f6b296d4

📥 Commits

Reviewing files that changed from the base of the PR and between 1ec4402 and 2dd1ec5.

⛔ Files ignored due to path filters (1)
  • iosApp/Silo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved is excluded by !**/Package.resolved
📒 Files selected for processing (3)
  • iosApp/Resources/OpenSourceLicenses/README.txt
  • iosApp/iosApp/Screens/Player/AetherPlaybackController.swift
  • iosApp/project.yml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

AetherEngine native item handoff

Layer / File(s) Summary
Update AetherEngine revision
iosApp/project.yml, iosApp/Resources/OpenSourceLicenses/README.txt
The package dependency and acknowledgement now use the blurbery/AetherEngine repository at revision e238d1d2da52b58bffd7f8135bb2b04e32915cee.
Arm native item replacement
iosApp/iosApp/Screens/Player/AetherPlaybackController.swift
prepareForReplacement() now calls engine.prepareForItemReplacement() before pausing the outgoing item.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 2dd1e

The PR makes a localized change to preserve video during episode autoplay handoff, with no actionable merge-blocking risk remaining beyond normal checks and review.

Suggested reviewers: quick104

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: fixing video visibility during tvOS episode autoplay transitions.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@Quick104
Quick104 merged commit abc5fc4 into Silo-Server:main Sep 2, 2026
1 check passed
Quick104 added a commit that referenced this pull request Sep 4, 2026
… the handover patch

The app was pinned to a personal fork of AetherEngine frozen at 6.34.0 with
five local commits. It now pins Silo-Server/AetherEngine at dfe11a08, which
is upstream 6.67.2 plus one re-implemented commit that lets a host request
the in-place native item handover on an episode change. That keeps the tvOS
autoplay fix from #221 while picking up 52 upstream releases, including the
6.50.0 loopback-origin exposure fix and the libzvbi GHSA-86rm-g7qf-j2fh
update via FFmpegBuild 3.0.0.

FFmpegBuild 3.0.0 renames the nine embedded frameworks with an Aether
prefix and moves to dav1d 1.5.4, zimg 3.0.6, and libzvbi 0.2.45; LibDovi
moves to 2.1.0 (dolby_vision 3.4.0). THIRD_PARTY_NOTICES.md, the in-app
acknowledgements, and quietvoid's libdovi notice are updated to the
resolved revisions.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Quick104 added a commit that referenced this pull request Sep 4, 2026
…x its attribution (#246)

* docs: correct AetherEngine attribution and credit the engine in README

THIRD_PARTY_NOTICES.md recorded the upstream 6.34.0 commit while the app
links 653be639, a published fork revision that adds Silo's handover patches.
The notices and in-app acknowledgements now name the fork branch as the
modified source, the upstream tag as its base, and state the LGPL
publication obligation for those patches. README.md now credits
AetherEngine and its author next to the other third-party notices.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* chore(deps): move AetherEngine to the Silo-Server fork at 6.67.2 plus the handover patch

The app was pinned to a personal fork of AetherEngine frozen at 6.34.0 with
five local commits. It now pins Silo-Server/AetherEngine at dfe11a08, which
is upstream 6.67.2 plus one re-implemented commit that lets a host request
the in-place native item handover on an episode change. That keeps the tvOS
autoplay fix from #221 while picking up 52 upstream releases, including the
6.50.0 loopback-origin exposure fix and the libzvbi GHSA-86rm-g7qf-j2fh
update via FFmpegBuild 3.0.0.

FFmpegBuild 3.0.0 renames the nine embedded frameworks with an Aether
prefix and moves to dav1d 1.5.4, zimg 3.0.6, and libzvbi 0.2.45; LibDovi
moves to 2.1.0 (dolby_vision 3.4.0). THIRD_PARTY_NOTICES.md, the in-app
acknowledgements, and quietvoid's libdovi notice are updated to the
resolved revisions.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* docs: record the FFmpegBuild 3.0.0 artifact inspection in the notices

The inventory claim described a 2.4.3 debug build. A tvOS Simulator debug
build against 3.0.0 was inspected: nine Aether-prefixed frameworks embedded,
--enable-shared present, no GPL, version3, or nonfree flags, and no FFmpeg
symbols exported by the app binary.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* chore(deps): bump the AetherEngine fork so the remote-HLS bypass honours the handover

CI's iOS suite failed PlayerSurfaceLayoutTests: the synthetic next-episode
handover on the nativeRemoteHLS route showed 2 item changes and 1 nil item.
The fork's bypass callsite never read the handover flag. Fork 745de1cc
consumes it the same way the loopback callsite does; the test now reports
1 item swap and 0 nil items.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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.

2 participants