Skip to content

feat(player): play embedded subtitles from the stream and switch them in place - #970

Merged
Quick104 merged 16 commits into
mainfrom
feat/instant-embedded-subtitles-combined
Nov 1, 2026
Merged

Quick104 merged 16 commits into
mainfrom
feat/instant-embedded-subtitles-combined

Conversation

@Quick104

@Quick104 Quick104 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #600
Pairs with Silo-Server/silo-android#770
Validation tasks: changes #313 C1, C2, C3, C4; changes #314 C1, C2, C3, C4

The Apple apps get many embedded subtitles from a sidecar URL. The server builds that sidecar by reading the whole source file, which takes up to minutes for a large file on network storage, so the subtitle shows late or not at all. This affects every embedded text track on a server copy remux, every embedded track the app can't identify in the open file, PGS in TS and M2TS files, and every switch between embedded text tracks on a transcode or remux, which also restarts the stream.

This pull request plays those tracks from the stream the app already has, makes switching between them instant, and draws AVPlayer's subtitle renditions in the viewer's subtitle style. At a maintainer's request it combines #953, #954, #955, #956 and #957 into one review, with one commit per former pull request and one follow-up fix.

Approach

It needs no server change to build or run. The server features it uses are negotiated, so a server without them keeps today's behaviour. The all-track renditions and the inventory stream_index come from Silo-Server/silo-server#3331, the combined server pull request. Silo-Server/AetherEngine#27 is a separate engine change that makes a subtitle declared at load fetch its sidecar once per selection, instead of twice; the AetherEngine pin bump follows once it merges and isn't part of this pull request. iOS, tvOS and macOS share all of it.

Copy-remux renditions (was #953)

  • What: every video start sends hls_remux_subtitle_renditions_v1, and the plan adapter accepts subtitle.hls_rendition on server_remux_hls with the same checks as on a transcode. Picking another embedded text track on a remux asks the server, which carries it in the stream, instead of mounting its sidecar, but only when the server lists the remux token.
  • Why: since feat(player): play embedded text subtitles from the transcode's HLS stream #821 a transcode carries its subtitle as a WebVTT rendition in its own HLS stream; a copy remux didn't, so it fell back to the whole-file sidecar.
  • Risks: subtitle delay doesn't apply to a rendition AVPlayer draws, as on a transcode today. Remux cue timing depends on the server's X-TIMESTAMP-MAP against fMP4 segments.

Row identity (was #954)

  • What: an embedded inventory row's FFmpeg stream index comes from the row: its stream_index when the server sends one, else the embedded_stream_index the server already puts on every embedded sidecar URL. Counting catalog tracks against inventory rows is the last resort. container_track_id and native_selectable are decoded too; all three are optional.
  • Why: the old ordinal matching named the wrong stream, or none, whenever the catalog and the inventory disagreed, and with none the pick fell back to the whole-file sidecar.
  • Risks: none identified. The URL fallback uses the same namespace as subtitle.embedded.stream_index.

All-track renditions with in-place switching (was #957)

  • What: when the server lists hls_subtitle_renditions_all_v1, the start request sends it and every replan repeats it. The server then carries every cue-indexed embedded text track as a WebVTT rendition, and each inventory row carries hls_rendition.
    • Rows match AVPlayer's options by playlist NAME (m3u8/NAME, since displayName is a localized language name), then by 1-based index.
    • A pick among them, or Off, switches the media selection at once and is reported with a subtitle_track_changed replan that shows no loading state. An answer that keeps the transport (same session, stream, expiry, timeline origin, media, audio and renditions) is adopted on the running item without a reload. A pick made while a report is out applies at once and is reported after it, latest wins.
    • Off is held against AVPlayer's automatic selection, since every rendition is AUTOSELECT=YES, and a sidecar pick takes a showing rendition down.
    • A listed row other than the showing one can be the secondary subtitle, from its sidecar and on the movie timeline.
    • The media credential scope admits silo_rendition=subtitles with a decimal silo_track, on the master playlist path only.
  • Why: with every track in the stream, a switch needs no new transcode or remux and no sidecar.
  • Risks: adopting a plan in place relies on the server copying the stream and expiry when it keeps the transport. A newer generation under the same URL and expiry would leave AVPlayer on the old one until it fails and recovers.

Native PGS in TS and M2TS (was #955)

  • What: the original-file capability declares native embedded subtitles for the scanner's ts and m2ts containers with hdmv_pgs_subtitle only. The automatic subtitle choice ranks that PGS like PGS in MKV.
  • Why: Aether already demuxes every subtitle stream of the open file and reassembles PGS display sets that MPEG-TS splits across packets, but these tracks still got a whole-file .sup sidecar.
  • Risks: DVB, DVD and teletext in a transport stream keep the sidecar or burn-in route. A multi-program stream hasn't been tried.

Rendition styling (was #956)

  • What: the player hands its subtitle appearance to AVPlayer as an AVTextStyleRule on every remote HLS item, and again when it changes: text color and opacity, the box, relative size, font family and text edge. An appearance that matches the device leaves AVPlayer on the system style.
  • Why: AVPlayer draws the stream's renditions itself, so they never reached Silo's overlay and ignored the viewer's settings.
  • Risks: position and the caption window stay AVPlayer's. The mapping hasn't been compared with the overlay on each device.

Validation

  • Build: iOS, tvOS and macOS build-only checks (Debug, Xcode 27.0) succeeded on the head commit, from a clean checkout.
  • Unit tests: the full SiloTests suite passed on an iOS 27.0 simulator (iPhone 17), ad-hoc signed: 3,682 tests, 0 failures.
  • CI script checks: the /api/v1 path guard and its test, Apple platform routing, subtitle packaging validation and build metadata tests passed locally.
  • iPhone on a shared dev server, with this change plus the AetherEngine#27 pin and the server stack:
    • Direct play: the embedded English track drew from the stream at start, and a mid-play switch to French showed its cue within about 2.5 s, with no subtitle request on the server.
    • A 720p transcode listed all 32 embedded tracks as renditions. A switch to Chinese kept the transport, and its cue showed within about 2 s while the video kept playing.
    • A file with forced and full English tracks drew the full dialogue from the stream.
    • On one switch, from English to English SDH, the server's plan didn't move until the next switch. The cause isn't confirmed; see Risks.
  • Review fixes (58d1688): the rendition-name resolver case fails on 59c6902 and passes with the fix; PlaybackProtocolV3Tests, PlaybackMediaAuthorizationTests, SubtitleAutoResolverTests and HLSRenditionTextStyleTests pass on an iOS 27.0 simulator (159 tests). The live AI pick fix is verified by tracing the code; no test covers it.
  • Not run on a device: copy remux, PGS in a transport stream, secondary subtitles, the rendition styling, Apple TV and Mac.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-apple/pr-970/

Risks

  • Stale feature list: an app that started before the server added hls_subtitle_renditions_all_v1 keeps its old feature list until it is relaunched, so its switches still restart the stream. This is expected for a negotiated feature.
  • One unreported switch: in the iPhone run the server's plan stayed on the previous row after one switch. Every local pick sends its report, unless the plan already selects that row or a report is still out, in which case only the newest pick is reported once that report settles. A report that fails isn't resent. The next replan of any kind carries the shown track. This isn't confirmed on a device log.
  • Server dependency: the renditions need feat(playback): read, keep and stream embedded subtitles without reading the whole file silo-server#3331; the stream identity works without it.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code shell and file tools; GitHub CLI; Xcode 27.0 (xcodebuild, XcodeGen) through a Mac build service; a shared simulator pool; agent-device for the iPhone run
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated. A maintainer asked for this one combined pull request. The iPhone run was driven by an agent on the maintainer's device; no human has checked it on Apple TV or Mac.
  • Adversarial review: a separate read-only Claude Code session (claude-opus-5-5) reviewed the whole stack at high effort, against the protocol contract and the server's wire shape. It found four bugs in the all-track switching, all fixed here: a second pick during a report reverted and showed a loading state; with Off, AVPlayer could select a rendition by itself; every listed row was refused as a secondary subtitle; and the scrubber jumped back after an in-place adoption. It also found two risks, both fixed: rows could be remapped by index alone, and a sidecar pick left a rendition drawn under it. On this pull request a review bot found a race after the in-place commit, now fixed: a new item could take the old plan's subtitle and buffering state. Review bots on the former pull requests found an outdated resolver test for transport-stream PGS, a secondary rendition row timed on the wrong clock, a queued seek skipped after a report with nothing to send, and a superseded subtitle change that could run after a newer pick; all are fixed here. Two bot findings were left as is: reverting transport-stream PGS to burn-in conflicts with the capability, and the m3u8/NAME lookup in commonMetadata is where AetherEngine measured the attribute on device. A /silo review round (Codex, gpt-6.1-sol, on 59c6902) found two more, both fixed in 58d1688: a live AI subtitle picked during a subtitle report was replaced by the reported rendition, and the index fallback could take an option another row matched by NAME. The Codex review bot then found two on 58d1688, both fixed in 66f5c00: an in-place subtitle report showed the Watch Party member as buffering, and an item that failed during a report was never recovered. Kody then found that a live AI pick during a report let an older queued subtitle change run after it; that's fixed in 1d62916. CodeRabbit found that a stall during a report showed the loading spinner at once; that's fixed in a045f41. Its note on restoring appliesMediaSelectionCriteriaAutomatically was left as is, because the pinned AetherEngine sets that flag to false itself.

🤖 Generated with Claude Code

Note

Play embedded HLS subtitle renditions in place with server-reported switching

...

Macroscope summarized 5215443.

Quick104 and others added 5 commits October 31, 2026 15:43
… stream

A server_remux_hls plan with an embedded text subtitle mounted the
inventory sidecar, which the server extracts by reading the whole source
file: minutes on network storage before the first cue.

The client now sends hls_remux_subtitle_renditions_v1 next to
hls_subtitle_renditions_v1, like the base token, in the static feature
list (the server ignores it where unknown and strips it on /api/v1).
The server then carries the selected track as subtitle.hls_rendition on
the remux too.

- The plan adapter accepts hls_rendition on server_remux_hls with the
  same checks as on server_transcode_hls.
- The load spec and controller already treat the rendition by delivery
  class (no sidecar declared, the row resolves to AVPlayer's legible
  option), so the remote-HLS path plays it as it does a transcode's.
- Picking another embedded text track on a remux replans instead of
  mounting its sidecar, but only when the decision's server_features
  list the remux token; otherwise the server would answer with the same
  sidecar and the pick stays local.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… row

A mid-play pick of an embedded subtitle on the open file needs the
row's FFmpeg stream index. The client derived it by counting embedded
catalog tracks against embedded inventory rows, and any disagreement
between the two lists named another stream or none. None meant the pick
fell back to the inventory sidecar URL: a whole-file server extraction
of a track Aether was already demuxing.

The row now answers first: its stream_index when the server publishes
it (contract C1), else the embedded_stream_index the server puts on
every embedded sidecar URL. Ordinal matching remains the last resort,
and the reverse lookup no longer maps a stream onto a row that names
another one. The picker, the local-switch check, the plan intent and
persistence all read the same resolution. container_track_id and
native_selectable are decoded too; all three are optional, so plans
from servers without them decode as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tream

On a server HLS plan only the selected embedded text track came in the
stream. Picking another one replanned and restarted the transcode or
remux, or mounted its sidecar, which the server extracts by reading the
whole source file.

A server that advertises hls_subtitle_renditions_all_v1 now gets it in
the start request, and every replan of the attempt repeats it. The
server then lists every cue-indexed embedded text track as a WebVTT
rendition of the stream, and each inventory row carries hls_rendition
{group_id, name, index}.

- Every listed row is a legible option of the stream. Rows match
  AVPlayer's options by playlist NAME, read from each option's
  m3u8/NAME metadata (displayName is a localized language name) and
  kept for the item, and by the 1-based index until the names are read.
  A pick made before its option appears waits for that row, and the
  plan's selected rendition is the one playback starts on.
- A pick among those rows, or Off, switches the media selection at once,
  then reports the change with a subtitle_track_changed replan that
  shows no loading state. While one report is out, the next pick also
  applies at once and its report waits, latest wins; the first answer
  never selects over it. An answer that keeps the transport (same
  session, stream, expiry, timeline origin, media, audio and renditions)
  and selects a rendition or Off is adopted on the running item with no
  reload; its first frame and plan summary are reported, and the
  playback time is left alone. Any other answer loads as before, and a
  failed report leaves playback running.
- Off on such a stream turns off AVPlayer's automatic media selection,
  deselects the legible group, and holds that until a track is picked,
  since every rendition is AUTOSELECT=YES. A sidecar or embedded pick
  takes a showing rendition down.
- A listed row other than the one showing can still be the secondary
  subtitle, from its inventory sidecar, timed on the movie timeline like
  any sidecar.
- A queued seek still runs when the waiting report has nothing to send,
  and a newer local pick drops a subtitle change queued behind a report.
- The media credential scope admits silo_rendition=subtitles with a
  container track number in silo_track.
- A decision's hls_rendition that omits index names its row by NAME.

The server fixture for the decision is vendored from the server branch
that implements the feature.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Direct play of a .ts or .m2ts file with a PGS track got the track as a
whole-file .sup sidecar, because the client declared native embedded
subtitles only for Matroska, MP4 and WebM.

Aether already demuxes every subtitle stream of the open source into
its packet store, and reassembles a PGS display set that MPEG-TS splits
across PES packets. The original_http capability
now declares native_embedded for the scanner's ts and m2ts containers
with hdmv_pgs_subtitle only. DVB, DVD and teletext subtitles in a
transport stream keep the server's sidecar or burn-in route until
they are checked on the same path. The automatic subtitle choice ranks
transport-stream PGS like PGS in MKV, since it no longer needs a burn-in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AVPlayer draws a server HLS stream's subtitle renditions itself, so they
never reached Silo's overlay and showed in AVPlayer's default style
whatever the viewer chose in subtitle settings.

The player now hands its appearance to AVPlayer as an AVTextStyleRule
on every remote HLS item, and again when the appearance changes: text
color and opacity, the box (transparent when there is none), size
relative to AVPlayer's own, font family and text edge. An appearance
that matches the device leaves AVPlayer on the device's caption style.
Position and the caption window stay AVPlayer's, because a rule can
move a cue line but not with the overlay's video-rect geometry.

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

silo-kody Bot commented Oct 31, 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 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 15f316fd-d62a-465f-94b5-376c6aa64b14
Commits

Reviewing files that changed from the base of the PR and between 3d80038 and 5215443.

Files selected for processing: 1
  • iosApp/iosApp/Screens/Player/PlaybackPrefsResolver.swift

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Walkthrough

The iOS player adds Protocol V3 HLS subtitle rendition negotiation and playback, including rendition selection, same-transport updates, secondary sidecars, and AVPlayer text styling. It also identifies unsupported embedded subtitle formats and excludes them from automatic and user selection.

Changes: Subtitle Playback and Selection

Layer / File(s) Summary
Protocol features and rendition data
iosApp/iosApp/Screens/Player/ProtocolV3/PlaybackProtocolV3Models.swift, iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift, iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift, iosApp/Tests/PlaybackProtocolV3Tests.swift, iosApp/Tests/Fixtures/PlaybackV3/*
Protocol V3 models and capability negotiation include remux and all-rendition features, subtitle inventory identity, and rendition metadata. Tests and a decision-response fixture cover negotiation and response data.
Plan validation and track mapping
iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift, iosApp/iosApp/Screens/Player/ProtocolV3/ProtocolV3SubtitleSelection.swift, iosApp/iosApp/Screens/Player/AetherLoadSpec.swift, iosApp/Tests/PlaybackProtocolV3Tests.swift, iosApp/Tests/SubtitleAutoResolverTests.swift, iosApp/iosApp/Screens/Player/PlaybackPrefsResolver.swift
Plan adaptation maps embedded stream identity and HLS rendition slots to picker tracks. It validates rendition selections and identifies same-transport plans. Transport-stream capabilities and PGS selection expectations are updated.
Native rendition selection and styling
iosApp/iosApp/Screens/Player/AetherPlaybackController.swift, iosApp/iosApp/Screens/Player/HLSRenditionTextStyle.swift, iosApp/iosApp/Screens/Player/PlaybackMediaAuthorization.swift, iosApp/Tests/HLSRenditionTextStyleTests.swift, iosApp/Tests/PlaybackMediaAuthorizationTests.swift
The controller resolves rendition rows to AVPlayer options and handles primary and secondary selections. Subtitle appearance settings generate AVPlayer text-style rules. Authorization accepts track-specific subtitle rendition queries.
Selection reports and same-transport updates
iosApp/iosApp/Screens/Player/PlayerViewModel.swift, iosApp/Tests/PlaybackProtocolV3Tests.swift, iosApp/Tests/PlayerTerminalFailureRetryTests.swift
The player reports rendition and Off selections, preserves newer local picks while a report is pending, and adopts same-transport plans without reloading. Tests cover selection, refusal handling, queued changes, and rendition switching.
Unsupported subtitle format handling
iosApp/iosApp/Networking/Models.swift, iosApp/iosApp/Screens/Detail/*, iosApp/iosApp/Screens/Player/PlayerTrack.swift, iosApp/iosApp/Screens/Player/PlaybackPrefsResolver.swift, iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift, iosApp/iosApp/Screens/Player/PlayerViewModel.swift, iosApp/Tests/DetailVersionSelectionTests.swift, iosApp/Tests/SubtitleAutoResolverTests.swift
Embedded tracks without a usable codec are marked unsupported and filtered from automatic, remembered, default, and explicit selections. Detail and playback track pickers disable unsupported rows and display an unsupported-format label.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PlayerViewModel
  participant PlaybackSessionBridge
  participant PlaybackV3Server
  participant ApplePlaybackV3PlanAdapter
  participant AetherPlaybackController
  PlayerViewModel->>PlaybackSessionBridge: Submit subtitle rendition report
  PlaybackSessionBridge->>PlaybackV3Server: Send Protocol V3 replan
  PlaybackV3Server-->>PlaybackSessionBridge: Return playback plan
  PlaybackSessionBridge-->>PlayerViewModel: Deliver playback plan
  PlayerViewModel->>ApplePlaybackV3PlanAdapter: Check transport and resolve subtitle choice
  PlayerViewModel->>AetherPlaybackController: Apply rendition or Off selection
Loading

Possibly related issues

  • Silo-Server/silo-apple#880 — The changes add in-place switching among HLS subtitle renditions, but do not show the inventory update contract described in the issue.
  • Silo-Server/silo-apple#978 — The changes filter unsupported tracks from saved selection matching, but do not establish that the candidate tie-order issue is fixed.
  • Silo-Server/silo-apple#589 — The changes alter embedded subtitle identity and switching, but do not show black-frame recovery behavior.

Suggested labels: stacked

Suggested reviewers: zzebrahz

Merge Risk: Minimal · up to 52154

The reviewed change resolves the saved-preference issue; no actionable merge-blocking risk remains in scope.

Security architecture risk: Low · up to 52154

The update changes how subtitles are negotiated and switched while keeping credentials tied to the current playback session. No introduced security weakness was identified in the reviewed paths. Server compatibility and interrupted or concurrent switches retain validation gaps.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly admitted credential-bearing request shape is bounded to the validated playback source's origin and exact session master-playlist path. The inspected client change does not admit arbitrary endpoints or another session's path. Server-side asset authorization remains an external enforcement dependency.

Trust Boundaries and Controls

  • observed — A playlist-controlled URL receives media headers only after scope admission. The new two-parameter form requires silo_rendition=subtitles and a one-to-twenty-digit silo_track value without a leading zero. Extra or duplicate parameters, other rendition values, and rendition queries on segment routes are not admitted by this form. Credential resolution also checks the captured account's server identity.
  • observed — Reusing the existing transport requires unchanged session, stream, delivery, media file, nonempty expiry, timeline origin and offset, recipe, audio selection, and rendition map. This constrains when an existing media authorization context can remain attached to a subtitle-only update.

Resilience and Maintainability Implications

  • observed — Recognized subtitle-switch refusals can preserve the current playback plan and undo the refused pick instead of terminating the session. Stale responses and abandoned candidates have explicit cleanup paths; cleanup failures remain best-effort with server timeout as the stated fallback.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 57.97% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… 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 "feat(player): play embedded subtitles from the stream and switch them in place" matches the main change. The PR adds playback of embedded subtitles as HLS renditions from the stream and in-…
Description check Passed The description explains the problem (slow whole-file sidecar subtitles), the approach (negotiated server features, copy-remux renditions, row identity, all-track renditions with in-place switching, n…
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.
Full details: Title check

Explanation

The title "feat(player): play embedded subtitles from the stream and switch them in place" matches the main change. The PR adds playback of embedded subtitles as HLS renditions from the stream and in-place switching between them, which the changeset implements across the player, protocol V3, and tests.

Full details: Description check

Explanation

The description explains the problem (slow whole-file sidecar subtitles), the approach (negotiated server features, copy-remux renditions, row identity, all-track renditions with in-place switching, native PGS in TS/M2TS, rendition styling), validation, and risks. These match the changed files, including the AetherPlaybackController, PlaybackProtocolV3 models, PGS capability, and HLSRenditionTextStyle.

Full details: Docstring Coverage

Explanation

Docstring coverage is 57.97% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 69 functions across 25 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T21:06:51.580561Z 3d80038 New commits
🔒 Security Review ✅ Completed 2026-11-01T21:07:15.624483Z 3d80038 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@macroscopeapp

macroscopeapp Bot commented Oct 31, 2026

Copy link
Copy Markdown

Evidence is missing: Evidence: link to follow is a placeholder, and the PR has no attached captures. The validation notes do not explain why evidence could not be captured.

  • Stream-backed subtitle playback and switching, including Off/secondary subtitles and native PGS in TS/M2TS (PlayerViewModel.swift, AetherPlaybackController.swift, PlaybackPrefsResolver.swift): no recording for iPhone, iPhone Duo folded and open, iPad, Mac, or Apple TV. Add recordings on each showing the affected playback and switching behavior; timing and multi-step switching require recordings.
  • AVPlayer subtitle styling (HLSRenditionTextStyle.swift, AetherPlaybackController.swift): no before-and-after capture on iPhone, iPhone Duo folded and open, iPad, Mac, or Apple TV. Add same-media playback captures demonstrating the rendition appearance before and after, and identify the device and build/commit for each capture.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

Comment on lines +881 to +883
for metadata in option.commonMetadata where metadata.identifier == identifier {
name = try? await metadata.load(.stringValue)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Playlist-name resolution fails because it searches commonMetadata for the format-specific m3u8/NAME identifier, leaving names unresolved and causing hlsSubtitleRenditionEngineIDs to select the wrong language through playlist-index fallback when AVFoundation reorders legible options. Read the NAME attribute from the option's available metadata formats before applying the index fallback.

Prompt for LLM

File iosApp/iosApp/Screens/Player/AetherPlaybackController.swift:

Line 881 to 883:

Playlist-name resolution fails because it searches `commonMetadata` for the format-specific `m3u8/NAME` identifier, leaving names unresolved and causing `hlsSubtitleRenditionEngineIDs` to select the wrong language through playlist-index fallback when AVFoundation reorders legible options. Read the NAME attribute from the option's available metadata formats before applying the index fallback.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lookup is correct as written. The pinned AetherEngine (df72cc59) reads the same attribute the same way, and Sources/AetherEngine/Native/RemoteHLSMediaSelection.swift:47 records that the verbatim NAME survives in commonMetadata under m3u8/NAME. That's where it was measured on device. metadata(forFormat:) isn't needed.

The index fallback next to it did have a gap when only some options carry a NAME. That's fixed in 58d1688 (see the review thread on line 864).

🤖 Claude Code in T3 Code (claude-opus-5-5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the correction. Given the on-device observation documented in the pinned AetherEngine, my claim that commonMetadata cannot expose m3u8/NAME was incorrect. Switching to metadata(forFormat:) is not warranted.

I withdraw this finding as a false positive. The partial-NAME index-fallback gap is a separate issue, addressed in 58d1688c as you noted.

uncommittedPrepared = nil
keepsCurrentPlan = true
self.adoptSameTransportProtocolV3Plan(next, selection: selection)
self.adoptBufferingPlan(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

Race condition identified in buffering-plan adoption: the pre-await check cannot prevent a suspended commitPendingProtocolV3Transition from completing and installing an outgoing load's buffering state after another item replaces it. Call requireCurrentStreamLoad(currentStreamLoadGeneration) immediately after the await and before publishing the buffering plan to protect both adoptBufferingPlan calls.

Also found in:

  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift:3077-3077

Kody rule violation: Finalize outgoing playback before publishing a replacement item

Prompt for LLM

File iosApp/iosApp/Screens/Player/PlayerViewModel.swift:

Line 3078:

Race condition identified in buffering-plan adoption: the pre-await check cannot prevent a suspended `commitPendingProtocolV3Transition` from completing and installing an outgoing load's buffering state after another item replaces it. Call `requireCurrentStreamLoad(currentStreamLoadGeneration)` immediately after the await and before publishing the buffering plan to protect both `adoptBufferingPlan` calls.

**Also found in:**
- `iosApp/iosApp/Screens/Player/PlayerViewModel.swift:3077-3077`

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed on the head this thread now points at. This comment was raised on d31534d, and 59c6902 added the recheck. After commitPendingProtocolV3Transition returns, the branch calls requireCurrentStreamLoad(currentStreamLoadGeneration) and checks activeAetherLoadEpoch == priorAetherLoadEpoch before adoptSameTransportProtocolV3Plan or adoptBufferingPlan runs. A replacement item or teardown during the commit ends the replan without adopting this plan.

🤖 Claude Code in T3 Code (claude-opus-5-5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. The post-await generation check and load-epoch guard you described address this race by preventing a superseded replan from publishing subtitle or buffering state.

The finding applies to d31534d and is addressed by 59c6902; no additional code change is needed for this finding.

switch container {
case "mkv": return ["subrip", "ass", "ssa", "webvtt", "hdmv_pgs_subtitle", "dvd_subtitle", "dvb_subtitle"]
case "webm": return ["webvtt"]
case "ts", "m2ts": return ["hdmv_pgs_subtitle"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

Incorrect native capability declarations advertise embedded PGS support in TS/M2TS, although the reviewed Apple capability contract requires burn-in for bitmap subtitles in those containers. Remove PGS from these declarations so server planning cannot bypass the required burn-in route.

Also found in:

  • iosApp/Tests/PlaybackProtocolV3Tests.swift:1146-1146
  • iosApp/Tests/SubtitleAutoResolverTests.swift:376-376
  • iosApp/Tests/SubtitleAutoResolverTests.swift:370-370
  • iosApp/Tests/PlaybackProtocolV3Tests.swift:1158-1158
  • iosApp/Tests/SubtitleAutoResolverTests.swift:377-377
  • iosApp/Tests/PlaybackProtocolV3Tests.swift:1150-1150

Kody rule violation: Rank subtitles using container capabilities and one stable cross-client policy

case "ts", "m2ts": return []
Prompt for LLM

File iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift:

Line 166:

Incorrect native capability declarations advertise embedded PGS support in TS/M2TS, although the reviewed Apple capability contract requires burn-in for bitmap subtitles in those containers. Remove PGS from these declarations so server planning cannot bypass the required burn-in route.

**Also found in:**
- `iosApp/Tests/PlaybackProtocolV3Tests.swift:1146-1146`
- `iosApp/Tests/SubtitleAutoResolverTests.swift:376-376`
- `iosApp/Tests/SubtitleAutoResolverTests.swift:370-370`
- `iosApp/Tests/PlaybackProtocolV3Tests.swift:1158-1158`
- `iosApp/Tests/SubtitleAutoResolverTests.swift:377-377`
- `iosApp/Tests/PlaybackProtocolV3Tests.swift:1150-1150`

Suggested Code:

        case "ts", "m2ts": return []

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changes that capability on purpose, so I'm leaving it as is. The pinned AetherEngine reassembles PGS display sets that MPEG-TS splits across PES packets (splitDisplaySetSubtitleStreamIndices, AetherEngine+SubtitleOCR.swift:198). The server's scanner reports these containers as ts and m2ts (containerForFile in internal/scanner/probe.go). The claim covers hdmv_pgs_subtitle only, so DVB, DVD and teletext in a transport stream keep the sidecar or burn-in route. Removing it would bring back the whole-file .sup extraction this section removes.

SubtitleAutoResolverTests.testEmbeddedPGSLosesToExternalTextOnlyWhereItNeedsABurnIn fails on the base and passes here. PGS from a transport stream hasn't been played on a device yet; the PR lists that under Risks.

🤖 Claude Code in T3 Code (claude-opus-5-5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed—my suggestion treated the previous capability contract as immutable, but this PR intentionally extends it. Based on the engine behavior and scanner identifiers you cited, advertising hdmv_pgs_subtitle for ts and m2ts is consistent with that change. Returning [] would undo it and restore the whole-file sidecar fallback.

I withdraw the suggested removal. The resolver test supports the intended selection policy; it does not establish device playback correctness. Transport-stream PGS playback remains an explicitly disclosed validation gap, not evidence that this declaration is wrong.

The referenced Kody rule may need a narrow update to recognize this PGS capability while preserving the existing fallback behavior for DVB, DVD, and teletext. I can make that update if you want; nothing has been changed.

…btitle plan

Adopting a plan that keeps the running stream waits for the session bridge
to commit it. A next episode or a teardown could replace the item during
that wait, and the plan's subtitle choice and buffering state were then
applied to the new item. The player now checks again after the commit that
the same load is still current before it adopts anything.

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

silo-kody Bot commented Oct 31, 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 left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two findings on 59c6902, both fixed in a follow-up commit on this branch. Both came from a cross-provider review round (Codex, gpt-6.1-sol), and I verified each against the source. The summary comment covers the bot threads, the tests, validation, docs, and parity.

🤖 Claude Code in T3 Code (claude-opus-5-5)

…h rendition names first

A live AI subtitle picked while a subtitle_track_changed report was out
skipped the local-pick bookkeeping, so the report's same-transport answer
selected the older rendition over it, and a failed report restored that
rendition as the local selection. The pick now counts as newer than the
report, and the rollback keeps the selection it left.

Rendition rows matched legible options by NAME and fell back to their
index in a single pass, so a row without a NAME match could take an option
a later row named. Every NAME match is now placed first, and the index
fallback skips options named for a row.

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

silo-kody Bot commented Oct 31, 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 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Review summary

Reviewed 59c6902; fixes pushed as 58d1688, 66f5c00, 1d62916 and a045f41. 7df969e and eb1fc7d, pushed after them, extends the failure-during-report fix to every recovery path and drops a report's answer once its item failed. I read both, 7df969e against the replan's cancellation path, and found no defect. The branch wasn't rewritten.

Fit: 8/10 · Readiness: 7/10 — conditional

Fit. The change serves the core experience. Embedded subtitles show up without the server reading the whole source file, so the server does less work and the viewer waits less. Every new behaviour is negotiated, so an older server keeps today's path. Two things stretch it. It combines five former pull requests into one review at a maintainer's request. The all-track renditions also depend on Silo-Server/silo-server#3331, which hasn't merged. Android parity is covered by Silo-Server/silo-android#770, now linked in the body.

Readiness. The approach is sound, and the six defects found by the review and the bots are fixed. Some of the change has been shown live: direct play and a transcode with in-place switching, on iPhone. Two of the tests fail on the base. These conditions remain:

  • Not run on a device: copy remux, PGS in a transport stream, secondary subtitles, the rendition styling, Apple TV, and Mac.
  • The one switch whose report the server's plan didn't follow on the iPhone run is still unexplained (Risks).
  • The all-track renditions need silo-server#3331, and the AetherEngine#27 pin bump is a follow-up.
  • Subtitle delay doesn't apply to a rendition AVPlayer draws. This is disclosed and matches how transcodes already behave.

Addressed findings

Both came from a cross-provider review round (Codex, gpt-6.1-sol, on 59c6902). I verified both against the source and fixed them in 58d1688.

  • A live AI subtitle picked during a report. The report's same-transport answer selected the older rendition over it. A pick on that path now counts as newer than the report, and a failed report no longer restores the rendition. I verified this by tracing the code. No test here can hold a replan response open.
  • The index fallback in the NAME/index resolver. It could take an option another row matched by NAME. NAME matches are now placed first. The new case in testRenditionRowsResolveToLegibleOptionsByNameThenIndex fails on 59c6902 and passes with the fix.

The Codex GitHub bot found two more on 58d1688. I verified both and fixed them in 66f5c00.

  • Watch Party buffering during a report. An in-place subtitle report counted as a transport transition, so Watch Party published the member as buffering and not ready. A report slower than the grace period could pause the room. It now counts only once its answer turns it into a load.
  • An item that fails during a report. Its recovery was refused as busy, and a same-transport answer kept the failed item in place. The failure is now held and recovered when the report settles, unless the answer loaded a new item.

Both are verified by tracing the code and an iOS test build.

Kody then found that a live AI pick during a report still let an older queued subtitle change run after it. That's fixed in 1d62916, which drops the queued subtitle change and keeps a queued audio one. CodeRabbit found that a stall during a report showed the loading spinner at once; that's fixed in a045f41. Its note on appliesMediaSelectionCriteriaAutomatically was then handled in eb1fc7d, which puts back the value the player had before the first deselect, not a blanket true. That leaves Aether's own load-time deselect intact.

Bot threads

  • Kody, m3u8/NAME in commonMetadata: not a defect. The pinned AetherEngine reads it the same way and records that it was measured on device.
  • Kody, race after the in-place commit: already fixed by 59c6902. The thread was raised on d31534d.
  • Kody, PGS in TS/M2TS: the PR changes that capability on purpose. Aether reassembles split PGS display sets, and the scanner names these containers ts/m2ts.
  • Macroscope's missing-evidence note is from before the body had its Evidence: link. That check now passes.

Tests that fail on the base

On an iOS 27.0 simulator, with this PR's test files run against the base (1a7ccee):

  • PlaybackMediaAuthorizationTests.testHLSMasterAuthorizesItsRenditionPlaylistsOnly fails: the base refuses silo_track playlist URLs.
  • SubtitleAutoResolverTests.testEmbeddedPGSLosesToExternalTextOnlyWhereItNeedsABurnIn fails: the base ranks transport-stream PGS as needing a burn-in.
  • PlaybackProtocolV3Tests and HLSRenditionTextStyleTests call API this PR adds, so they can't build on the base and don't count as base-failing evidence.

On 58d1688 those four classes pass (159 tests). a045f41 compiles for iOS. CI passed on eb1fc7d, including the iOS, tvOS and macOS regression suites.

Validated features

None found affected. The validation board wasn't readable from this review. Validation issues #313 and #314 show every case as not run, so no passed case can regress. The body's Validation tasks: line (changes #313 C1–C4, #314 C1–C4) matches the cases this touches.

User manual

Needs an update once this and silo-server#3331 merge. using-silo/subtitles.md says that turning on or switching a subtitle from inside the file "restarts the video at the same spot". On a server with the all-track renditions, Apple now switches in place, and silo-android#770 does the same. No siloserver.org issue covers this yet. I recommend one for that passage, written as a paired Apple and Android topic. It should also note that the delay setting doesn't move subtitles AVPlayer draws from the stream.

Apple/Android parity

Silo-Server/silo-android#770 makes the same change on Android (copy-remux renditions, row identity, all-track renditions with in-place switching). It's now linked from this PR's body.

🤖 Claude Code in T3 Code (claude-opus-5-5)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58d1688c9f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… recover an item that fails during one

An in-place subtitle report still counted as a transport transition, so
Watch Party published the member as buffering and not ready while playback
continued, and a report slower than the grace period could pause the room.
A report now counts as a transition only once its answer turns it into a
load.

An item that failed while a report was out had its recovery refused as
busy, and a same-transport answer then kept the failed item in place. The
failure is now held and recovered when the report settles, unless the
answer loaded a new item. A report that becomes a load also stops letting
local picks apply as if the running stream were kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…during a report

A subtitle the server had to replan, picked while a report was out, waited
behind it as a queued track change. A live AI pick after it still let that
older change run once the report settled, replacing the AI subtitle. The
AI pick now drops a queued subtitle change, as a local pick already does,
and keeps a queued audio change.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ebe0444d-7397-4c41-9726-d5e6a40a6586
Commits

Reviewing files that changed from the base of the PR and between b697a96 and 58d1688.

Files selected for processing: 17
  • iosApp/Tests/Fixtures/PlaybackV3/SOURCE
  • iosApp/Tests/Fixtures/PlaybackV3/hls-subtitle-renditions-all-decision_response.json
  • iosApp/Tests/HLSRenditionTextStyleTests.swift
  • iosApp/Tests/PlaybackMediaAuthorizationTests.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/Tests/SubtitleAutoResolverTests.swift
  • iosApp/iosApp/Screens/Player/AetherLoadSpec.swift
  • iosApp/iosApp/Screens/Player/AetherPlaybackController.swift
  • iosApp/iosApp/Screens/Player/HLSRenditionTextStyle.swift
  • iosApp/iosApp/Screens/Player/PlaybackMediaAuthorization.swift
  • iosApp/iosApp/Screens/Player/PlaybackPrefsResolver.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3Capabilities.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/PlaybackProtocolV3Models.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ProtocolV3SubtitleSelection.swift

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

…itle report

A subtitle report keeps the running stream, but it still counted as
preparing a replacement, so a brief stall while it was out showed the
loading state at once instead of after the frozen-playhead threshold.
The stall classification and the Watch Party snapshot now share one
predicate that leaves a report out until its answer turns it into a load.

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

silo-kody Bot commented Oct 31, 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 ❌

…ly server-adaptable ones

Only the server-adaptable failure arm waited for a subtitle report in
flight. A failure that reached handlePlaybackError's recovery still hit the
busy replan gate and was dropped. Both arms now share one path: the
failure is held for the report's exit, and playback shows that it stopped.

The report's answer also no longer commits onto the failed item. It is
dropped, and the held recovery replaces the item as the report exits.

The rule that a newer subtitle pick drops a queued subtitle change, used by
the local and live AI paths, is one helper with a test.

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

silo-kody Bot commented Oct 31, 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 ❌

…rendition stream ends

Deselecting a stream's subtitle renditions turned off
appliesMediaSelectionCriteriaAutomatically on Aether's native player and
never turned it back on. That player is kept across consecutive loads, so
every later stream, with renditions or without, started with automatic
selection off. The controller now records the player's value when it first
turns it off and puts it back when the stream's rendition state resets: on
a new load, a failed or cancelled one, a replacement, or stop.

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

silo-kody Bot commented Oct 31, 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 ❌

…974)

* fix(player): keep playing when the server refuses a subtitle switch

Picking an embedded subtitle the server can't deliver (for example a
Matroska S_TEXT/WEBVTT track its probe stored with no codec) got a
subtitle_codec_unsupported terminal back from the replan. The player
treated it as a route dead end, reported a terminal route event, and
tore playback down.

A track-change replan for a viewer's subtitle pick now treats the
server's subtitle refusals as ending only the switch. The bridge throws
PlaybackV3SubtitleRefusal without reporting a terminal or touching its
attempt state. The player keeps the current plan, puts the picker back
to the selection the pick replaced, shows "This subtitle can't be
shown", and logs [CMP-SUB] phase=replan_refused. The pick's preference
is saved only once the server hasn't refused it, so a reload doesn't
ask for the track again.

The picker on iPhone, iPad, Apple TV and Mac shows an embedded track
with no codec as disabled, labelled "Unsupported format", and automatic
selection skips it.

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

* fix(detail): don't offer or start on a subtitle the server can't deliver

The player disabled an embedded track the server stored with no codec,
but the detail page still offered it. Picking it there, or Auto landing
on it as the file's default, put it in the start request, and the
server refused the whole start with subtitle_codec_unsupported.

- The detail page's subtitle list shows the track as unselectable,
  labelled "Unsupported format", on iPhone, iPad, Mac and Apple TV.
- Detail candidates carry the same mark, so Auto never resolves to it,
  and the "leave it to the file" fallback skips it when it is the
  default track, in the detail preview and at the start alike.
- A saved pick of it, by stream index or combined ordinal, starts
  without subtitles, and the detail page reads a remembered pick of it
  as Auto.

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

* fix(player): save a subtitle pick only once its plan plays

A pick's preference was saved when its replan settled, so a failed or
abandoned replan still saved it. It's now saved only once its plan is
adopted.

A pick queued behind another one now learns how that one settled. If
the older pick was adopted and the newer one is refused, the picker
returns to the older pick and saves it. If the older pick was refused,
the newer pick's refusal returns to what is actually playing. A pick
that replaces a queued pick inherits its rollback. A queued audio pick
that a subtitle pick replaced is asked for again if the server refuses
the subtitle.

The detail page no longer seeds a remembered pick of a track the server
can't deliver.

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

* fix(player): keep a queued subtitle pick when an audio pick follows it

An audio pick made while a subtitle pick waited behind a replan replaced
it in the queue. The audio request still carried the subtitle, but
without the pick's rollback and refusal handling, so a refused subtitle
ended playback. The audio pick now joins the queued subtitle pick's
request. Both selections are restored before that request reads them
back, audio first.

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

---------

Co-authored-by: zZebrahz <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Nov 1, 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 ❌

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5401bdfea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

static func queuedTrackChangeAfterSubtitlePick(
_ queued: QueuedProtocolV3TrackChange?
) -> QueuedProtocolV3TrackChange? {
if case .subtitle? = queued?.target { return nil }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve joined audio picks when dropping a queued subtitle change

If a subtitle report is in flight, the viewer queues a server-switched subtitle, then selects audio, subtitleChange(_:joinedBy:) stores that audio target in the queued subtitle pick's audioPick. Selecting a live AI subtitle before the report finishes calls this helper and drops the entire queued change, including the audio target. The report's completion then republishes the original audio selection through adoptAetherInventory(), and no audio replan runs, even though the audio preference was already saved. When discarding a superseded subtitle change, retain its joined audioPick as an audio-only queued change.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 28dc141: when a newer subtitle pick drops a queued subtitle change, a joined audio pick now stays queued as an audio-only change. Added a row to testASubtitlePickDropsOnlyAQueuedSubtitleChange.

…s the queued change

An audio pick made while a server-switched subtitle change was queued joins
that change. A local or live AI subtitle pick made before the report in
flight returned dropped the whole queued change, so the audio switch never
ran even though its preference was saved. Keep the joined audio pick as an
audio-only queued change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@@ -7858,7 +8181,13 @@ class PlayerViewModel {
/// track's teardown): a series preference records what the viewer

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

Subtitle cycling on macOS stalls when the unsupported-format early return prevents selectedSubtitleId from advancing: cycleSubtitleTrack repeatedly passes the same unsupported row, leaving later supported tracks and Off unreachable through the cycle command. Filter unsupported rows in cycleSubtitleTrack and toggleSubtitles before selecting the next or first candidate.

Prompt for LLM

File iosApp/iosApp/Screens/Player/PlayerViewModel.swift:

Line 8181 to 8181:

Subtitle cycling on macOS stalls when the unsupported-format early return prevents selectedSubtitleId from advancing: cycleSubtitleTrack repeatedly passes the same unsupported row, leaving later supported tracks and Off unreachable through the cycle command. Filter unsupported rows in cycleSubtitleTrack and toggleSubtitles before selecting the next or first candidate.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: the unsupported-format early return in selectSubtitle is new in this PR, so cycling stalled on the first unsupported row. Fixed in the next commit: cycleSubtitleTrack and toggleSubtitles choose only among playable rows.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for confirming—that explains why cycling stalled. Restricting both cycleSubtitleTrack and toggleSubtitles to playable rows should address the regression.

Please include regression tests covering unsupported rows before and between playable tracks, plus the case where no playable tracks exist, so both actions handle those cases gracefully.

@Quick104 Quick104 Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not adding a test here: cycleSubtitleTrack/toggleSubtitles are instance methods on the full player view model with no existing test harness, and the fix only filters the candidate list.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood—manual validation through the macOS shortcuts is reasonable for this small candidate-filter fix without an existing view-model test harness. No need to introduce one for this change.

The relevant cases are unsupported rows before and between playable tracks, cycling back to Off, and no playable tracks available.

…subtitles

selectSubtitle refuses unsupported rows, so the macOS cycle command stalled
on the first one and never reached later tracks or Off. Cycle and toggle now
pick only among playable rows.

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

silo-kody Bot commented Nov 1, 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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Exclude unsupported tracks in savedPickApplies. · PlaybackPrefsResolver.swift:263-266

iosApp/iosApp/Screens/Player/PlaybackPrefsResolver.swift:263-266
Minor · Functional Correctness · Quick win

Exclude unsupported tracks in savedPickApplies.

When an unsupported embedded English track matches the saved pick, startSession suppresses the device caption preferences. resolve then removes English and does not select the available French track. Filter unsupported tracks before matching the saved pick.

Suggested fix
     static func savedPickApplies(
         _ signature: SubtitleTrackSignature?,
         to tracks: [SubtitleTrack]
     ) -> Bool {
         guard let signature else { return false }
+        let playableTracks = tracks.filter { !$0.hasUnsupportedFormat }
         if let language = signature.language, !language.isEmpty {
-            return tracks.contains { track in
+            return playableTracks.contains { track in
                 guard let trackLanguage = track.language, !trackLanguage.isEmpty else { return false }
                 return languagesMatch(trackLanguage, language)
             }
         }
         guard let label = signature.label, !label.isEmpty else { return false }
-        return tracks.contains { ($0.title ?? $0.embeddedTitle)?.localizedCaseInsensitiveContains(label) == true }
+        return playableTracks.contains {
+            ($0.title ?? $0.embeddedTitle)?.localizedCaseInsensitiveContains(label) == true
+        }
     }

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89a45b98-98f6-40db-b77b-4203f01d74fa
Commits

Reviewing files that changed from the base of the PR and between 58d1688 and 3d80038.

Files selected for processing: 18
  • iosApp/Tests/DetailVersionSelectionTests.swift
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/Tests/PlayerTerminalFailureRetryTests.swift
  • iosApp/Tests/SubtitleAutoResolverTests.swift
  • iosApp/iosApp/Networking/Models.swift
  • iosApp/iosApp/Screens/Detail/DetailPlaybackFormatting.swift
  • iosApp/iosApp/Screens/Detail/ItemDetailView.swift
  • iosApp/iosApp/Screens/Detail/SubtitleTrackCandidates.swift
  • iosApp/iosApp/Screens/Player/AetherPlaybackController.swift
  • iosApp/iosApp/Screens/Player/OfflinePreparedTrackInventory.swift
  • iosApp/iosApp/Screens/Player/PlaybackPrefsResolver.swift
  • iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift
  • iosApp/iosApp/Screens/Player/PlayerTrack.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • iosApp/iosApp/Screens/Player/ProtocolV3/ApplePlaybackV3PlanAdapter.swift
  • iosApp/iosApp/Screens/Player/Sheets/TrackSelectionSheet.swift
  • iosApp/iosApp/Screens/Player/tvOS/TVPlayerInfoHUD.swift
  • iosApp/iosApp/macOS/MacPlayerOptionsPanel.swift

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

… pick

resolve drops unsupported tracks, so a saved pick that only matched one
suppressed the device caption policy and left no subtitle selected.

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

Quick104 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Re CodeRabbit outside-diff finding on savedPickApplies (PlaybackPrefsResolver.swift:263): confirmed, since resolve now drops unsupported tracks. Fixed in 5215443: savedPickApplies matches only playable tracks.

@silo-kody

silo-kody Bot commented Nov 1, 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 ❌
⚠️ 3 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Centralize server-relative authentication path validation
  • Enforce latest-link-wins centrally across deferred deep links
  • Rank subtitles using container capabilities and one stable cross-client policy

@coderabbitai coderabbitai Bot added the stacked Stacked on another open PR or branch label Nov 1, 2026
@Quick104
Quick104 merged commit cc87791 into main Nov 1, 2026
10 checks passed
@Quick104
Quick104 deleted the feat/instant-embedded-subtitles-combined branch November 1, 2026 21:47
@0dragosh

0dragosh commented Nov 2, 2026

Copy link
Copy Markdown

@Quick104 a note on #589 (embedded SRT drops after a brief black frame on Apple TV), since this PR works right next to it but doesn't close it.

The diagnosis in #589 (comment) puts the cause in mid-playback reloads: attemptProtocolV3Replan and the credential reload call engine.load without arming the in-place handover (prepareForReplacement()). Aether then unloads the old item first, so the layer is item-less until the new first frame (the black frame), and the engine's subtitle selection is cleared in the same event.

What this PR changes there:

So #589 still looks open after this merge. The fix suggested in the issue still applies: arm the handover for any same-engine reload, not only fresh loads, so the old picture stays up until the swap. Worth a follow-up?

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

Labels

enhancement New feature or request impact: playback Can't play, stalls, or wrong media priority: P2 Limited scope, workaround exists, or polish size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. stacked Stacked on another open PR or branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants