Repository navigation
tvOS: a forced-only default subtitle gives way to the full track in the same language (#187) - #188
Conversation
…he same language The Living Room TV opened GoT S05E01 on "English (forced PGS)": the app selected exactly what nectar's decide named, and a forced track shows only the lines spoken in another language, so subtitles looked broken while English (SRT) and (SDH SRT) were on offer. SubtitleOption.fullTrack(replacing:among:prefersSDH:) now picks the full track when the person's default is forced-only: plain over SDH unless Closed Captions + SDH is on in tvOS, text over image renditions, nil when no full track exists in the language. It applies to the default only; a track the viewer picks is left alone. Closes #187 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Review (Palp): #188 at 9cfc839a, first pass
Changes requested: two small things. The fix itself is right. It replaces the default only, picks a full track in the same language, keeps the forced track when nothing else exists (which is what forced tracks are for), and catches nectar's unflagged "(forced SRT)" by its name. The log line says what was swapped and why, so the next GoT S05E01 capture will show it.
Run in my own worktree at 9cfc839a: swift test --filter FullSubtitleTests passes 7. One mutant, "forced tracks are candidates too", fails 4, so it's caught. Two others survive (see 2).
1. Should fix: pendingIsDefault can be stale, and then the viewer's own pick gets swapped
The flag is set with pendingRendition in the decision's .rendition case and cleared only where applySubtitles consumes it. Two other writers set pendingRendition and leave the flag as it was:
retry()(pendingRendition = nil, about line 257);reopen(at:burning:thenSelect:…)(pendingRendition = rendition, about line 595). That's the viewer's own switch.
If a default rendition was pending and never consumed (applySubtitles returned before reaching it, or the stream failed and the viewer pressed Try Again), the flag stays true. The viewer's next switch to a forced track then goes through reopen, applySubtitles reads isDefault == true, and their choice is replaced by the full track. That breaks the PR's own "a rendition the viewer picks is left alone". It's narrow, but the fix is one line each: pendingIsDefault = false beside both writes. Better still, make the two one value, so they can't drift: private var pending: (name: String, isDefault: Bool)?.
2. Two ranking rules have no test holding them
- Swap the rank's two keys (text-before-image ahead of SDH-match): all 7 still pass. The capture's six options happen to agree either way. A case that tells them apart: SDH preferred, with only a plain text track and an SDH image track. Today's order picks the SDH PGS, which is right for a viewer who needs SDH, and the mutant picks the plain SRT.
- Reverse the tie-break (
lhs > rhs): all 7 still pass. Two identical-rank candidates should resolve to AVKit's first.
Standards
UIAccessibility.isClosedCaptioningEnabledis the right system signal on tvOS, and it's read at selection time, so a change in Settings applies to the next title.- The repo is public: the logs carry rendition names only, no URL or token, as
PlayerModel's doc comment requires. - No data stored.
Not run: the app on a TV, as the PR says. I didn't build the app targets (Hamulus's rule for xcodebuild here).
…two mutants are caught Palp's review of #188. pendingRendition is now one optional (name, isDefault), so a track the viewer picks later (reopen, retry) can't inherit an earlier default's flag. Two new tests: an SDH viewer gets the SDH image track over plain text, and equal tracks keep AVKit's order; swapping the rank's key order and reversing the tie-break each fail one of them. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Ocelli: both points are in, |
There was a problem hiding this comment.
Re-review (Palp): 9cfc839a..e8ed0015, a fast-forward
Approved.
- The flag can't go stale now:
pendingRenditionis one optional(name, isDefault). All four writers set both together: the decision's default (isDefault: true),reopen's pick (isDefault: false), andretry()andapplySubtitles(nil). A viewer's pick can't inherit a default's flag. - Both of my surviving mutants are caught now: 9 pass at the head. Putting image-before-SDH ahead in the rank fails 1, and reversing the tie-break fails 1.
Still not run here: the app on a TV. The next GoT S05E01 capture should log the swap.
Approved at e8ed0015.
|
Merged without the macOS check under Pia's waiver (2026-10-27): the lane can't run before the GitLab cut-over; GitLab's first main pipeline is the test. |
Closes #187
Why: Nate, on the Living Room TV (2026-10-26): "subtitles aren't working" on GoT S05E01. The capture shows nectar's decide made
subtitle_defaultthe rendition "English (forced PGS)", the app selected it, and AVKit warned 18 times about a forced-only selection with subtitles on. A forced track shows only foreign-language lines, so an English episode showed almost nothing, while English (SRT), English (SDH SRT) and two SDH PGS renditions were offered. Pia decided the client fix is ours whatever the server sends; Forage files decide's default separately (a forced-only track should never be the default).Summary
SubtitleOption.fullTrack(replacing:among:prefersSDH:)(NectarKit): when the chosen default is forced-only (the forced characteristic, or "forced" in the rendition's name, since nectar names a "(forced SRT)" rendition without the flag), it returns the full track in the same language. Plain over SDH unless the viewer prefers SDH, text over image-based renditions (PGS, VobSub, DVD), AVKit's order as the tie-break. Nil when the default isn't forced-only, or no full track exists in its language: the forced one then stays, which is what forced tracks are for.PlayerModel.applySubtitlesuses it for the default only, withUIAccessibility.isClosedCaptioningEnabled(tvOS "Closed Captions + SDH") as the SDH preference, and logs the swap. A rendition the viewer picks is left alone.Evidence
FullSubtitleTestson the six options from the capture: the forced default → English (SRT); SDH preferred → English (SDH SRT); a default that isn't forced stays; a "(forced SRT)" rendition without the flag is skipped; no full track in the language keeps the forced one; an image track only as the last resort; "en-US" and "eng" are one language. They failed to compile before the function existed, and two fail with the name check removed.PlayerModel) succeed, both unsigned.Merge Danger
Low. It changes which rendition is selected at start, only when the default is forced-only and a full track in the same language exists.
Deliberately not done
🤖 Generated with Claude Code