Skip to content

feat(tvos): send the playing title's poster and synopsis in remote state - #871

Merged
Quick104 merged 2 commits into
mainfrom
feat/remote-now-playing-poster
Oct 22, 2026
Merged

Quick104 merged 2 commits into
mainfrom
feat/remote-now-playing-poster

Conversation

@Quick104

@Quick104 Quick104 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A Home Assistant integration that controls an Apple TV over SiloRemote gets the title, subtitle, position, and controls from the playback state, but no artwork or synopsis. To show a poster it has to sign in to Silo separately and look up the item by contentId. That adds a second sign-in, or an API key, just to draw a picture the TV already has.

Solution

The state payload gets two optional fields:

{ "posterUrl": "https://…/api/v2/artwork/…?exp=…&sig=…", "overview": "Episode or movie synopsis" }

TVControlReceiver fills them from a new SiloControlNowPlayingMetadataResolver:

  • Source: the TV's existing sign-in. It reads the cached item detail first and fetches only when the copy is missing or its poster URL is within 10 minutes of expiring.
  • Episodes: the series poster only. An episode's own poster is its 16:9 still, which spoiler protection may hide, so the TV never sends it; without a series poster, posterUrl is omitted. The synopsis is the episode's own, falling back to the series synopsis. A failed series lookup counts as a failed load and is retried.
  • URL: the absolute, signed URL from item detail, either Silo's /api/v2/artwork route or an object-storage URL. Neither needs an auth header, so the controller downloads the image from Silo or the CDN directly.
  • Lifetime:
    • The TV fetches a re-signed URL 10 minutes before exp, or before X-Amz-Date + X-Amz-Expires for S3. It re-checks every 30 minutes when the expiry can't be read.
    • It never sends an expired URL.
    • Both fields drop out when playback stops or the content ID changes, including an autoplayed next episode, and return once the new title resolves.
  • Cost: the resolver runs only while an authorized controller is connected, as the state ticks already do.

Both fields are omitted rather than sent as null when unknown. Older peers ignore them: Swift's synthesized decoder skips unknown keys, and Android decodes with ignoreUnknownKeys = true. So there is no protocol version bump or feature flag, and no new endpoint, command, or auth flow.

The phone remote is unchanged. It still resolves its own artwork from contentId.

Validation

  • SiloTV on a tvOS simulator, SiloControlNowPlayingMetadataTests (11 new) and SiloControlWireCompatibilityTests (14 existing): 25 of 25 pass on d01bf59. They cover:
    • frames without the fields decode, and nil fields stay off the wire
    • a decoder that predates the fields accepts new frames
    • episodes use the series poster and never their own still; item fixtures decode with the production snake_case strategy
    • Silo and S3 expiry parsing and the refresh schedule
    • the resolver loads, refreshes from the network with the re-signed URL, clears on a title change and on stop, and withholds an expired poster
  • Silo (iOS simulator) and SiloMac builds with CODE_SIGNING_ALLOWED=NO: both succeed.
  • Not checked: a live run on an Apple TV with a controller connected.

Validation tasks: none

Evidence

Evidence: none, no user-visible change. The TV's own screens are unchanged; the new fields only appear in the remote-control state, and no controller displays them yet.

Risks

Low. Two optional state fields are added, and the TV makes at most a few item-detail requests per title while a controller is connected. With a short server artwork TTL (minimum 1 minute), the TV refreshes once a minute.

Follow-ups

AI disclosure

  • AI tool(s): Claude Code, mac-builder
  • AI model(s): claude-opus-5-5 (wrote the code and tests)
  • AI involvement: The agent designed the wire fields with the developer, implemented the resolver and receiver wiring, wrote the tests, and ran them on MacDev.
  • Adversarial review: none run on this change.

🤖 Generated with Claude Code

Note

Add poster and synopsis to tvOS remote control playback state

Sends the playing title's artwork and overview to remote controllers in the state frame.

  • Adds optional posterUrl and overview fields to SiloControlPlaybackState; nil values are omitted from the wire and older decoders without the fields still accept new frames
  • SiloControlNowPlayingMetadata selects the series poster for episodes (never the episode still) and prefers the item's own overview with series overview as fallback; blank strings become nil
  • SiloControlNowPlayingMetadataResolver tracks the current title, loads metadata from the catalog, and re-signs artwork with cache bypass before expiry; it parses Silo and S3 signed-URL expiry formats and withholds an expired poster while keeping the overview
  • TVControlReceiver broadcasts a fresh state when metadata resolves or re-signs, and drops the previous title's metadata on playback changes
  • Behavioral Change: state frames now include posterUrl and overview keys when populated; nil metadata is omitted on the wire

Macroscope summarized d01bf59.

The SiloRemote playback state now carries two optional fields, posterUrl
and overview. A controller without its own Silo sign-in, such as a Home
Assistant integration, can show real artwork and a synopsis.

The Apple TV resolves them from the cached item detail, falling back to
the network, and uses the series poster for episodes. It fetches a
re-signed URL before the signature expires, never sends an expired one,
and drops both fields when playback stops or the title changes. It does
this work only while a controller is connected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Oct 21, 2026
@silo-kody

silo-kody Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 969d845b-f758-4da2-9041-e44ab4c97f0f
📥 Commits

Reviewing files that changed from the base of the PR and between 61b6ea8 and 9072d6f.

📒 Files selected for processing: 4
  • iosApp/Tests/SiloControlNowPlayingMetadataTests.swift
  • iosApp/iosApp/Control/SiloControlNowPlayingMetadata.swift
  • iosApp/iosApp/Control/SiloControlProtocol.swift
  • iosApp/iosApp/Control/tvOS/TVControlReceiver.swift

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

📝 Walkthrough

The tvOS control protocol now carries optional poster and overview metadata. A resolver loads this metadata, refreshes expiring artwork, and supplies it to receiver playback state.

Changes: Now-Playing Metadata

Layer / File(s) Summary
Metadata fields and selection
iosApp/iosApp/Control/SiloControlProtocol.swift, iosApp/iosApp/Control/SiloControlNowPlayingMetadata.swift, iosApp/Tests/SiloControlNowPlayingMetadataTests.swift
Playback state adds optional poster and overview fields. Metadata selection combines episode and series details, with tests for selection and wire-format compatibility.
Expiry-aware metadata resolution
iosApp/iosApp/Control/SiloControlNowPlayingMetadata.swift, iosApp/Tests/SiloControlNowPlayingMetadataTests.swift
The resolver tracks titles, loads cached or network metadata, and schedules refreshes based on artwork URL expiry. Tests cover refresh behavior, title changes, clearing, and expired artwork.
Receiver state integration
iosApp/iosApp/Control/tvOS/TVControlReceiver.swift
The receiver adds resolved poster and overview values to playback state and clears tracked metadata when playback is idle or a player unregisters.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant TVControlReceiver
  participant SiloControlNowPlayingMetadataResolver
  participant MetadataRequestPool
  TVControlReceiver->>SiloControlNowPlayingMetadataResolver: Track content ID and resolve metadata
  SiloControlNowPlayingMetadataResolver->>MetadataRequestPool: Fetch item and series details
  MetadataRequestPool-->>SiloControlNowPlayingMetadataResolver: Return item and series details
  SiloControlNowPlayingMetadataResolver-->>TVControlReceiver: Notify metadata changes
  TVControlReceiver->>TVControlReceiver: Add poster and overview to playback state
Loading
Merge Risk: ⚪ Minimal · up to 9072d

The metadata change is ready to merge after normal checks. A live Apple TV session with a connected controller remains untested, but no specific failure was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding the playing title's poster and synopsis to tvOS remote state.
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 The pull request description directly explains the added playback-state metadata fields, resolver behavior, URL expiry handling, compatibility, testing, and receiver integration. These details match t…
Full details: Description check

Explanation

The pull request description directly explains the added playback-state metadata fields, resolver behavior, URL expiry handling, compatibility, testing, and receiver integration. These details match the changeset.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@silo-triage silo-triage Bot added enhancement New feature or request priority: P2 Limited scope, workaround exists, or polish labels Oct 21, 2026
…eries lookups

An episode now sends only its series poster: the episode's own poster is its
still, which spoiler protection may hide and which is 16:9 anyway. A failed
series lookup now fails the load, so the resolver retries it instead of
settling for an episode without its poster. The test fixtures decode with the
production snake_case strategy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104
Quick104 merged commit 755a101 into main Oct 22, 2026
9 of 10 checks passed
@Quick104
Quick104 deleted the feat/remote-now-playing-poster branch October 22, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant