feat(subtitles): Customize how captions look in Settings › Subtitles #42

Merged
namillis merged 2 commits from feat/subtitle-style into main 2026-11-10 14:52:58 +00:00
Owner

What changed

Settings has a new Subtitles row (under Playback) that shows the current caption style and opens Settings › Subtitles. That screen has one row per caption setting and a preview on the right:

  • Text size: Small, Medium, Large, Extra large
  • Text color: White, Yellow, Cyan, Green
  • Background: Box, See-through, None
  • Edge: None, Outline, Shadow
  • Font: Default, Mono, Serif
  • Placement: As broadcast (default) or Always bottom
  • Reset to default

◀ ▶ change a row's value. OK cycles it forward and wraps (Extra large back to Small). Changes save at once and apply to the player straight away.

This follows mockup option B in design/mockups/bgrid/subtitles/, with one change agreed during design review. The mockup's Position row (Bottom / Raised) became Placement (As broadcast / Always bottom). Raised is no longer a setting: captions move up on their own while the info bar shows.

What looks different with no setting touched

The default style is medium white text on a black box, the same as Media3's default. Even so, captions change for everyone in four ways:

  • The broadcaster's colors, fonts and sizes are ignored. The user's style always wins, so a broadcaster that colors a speaker's lines now shows them in the chosen color.
  • Android's system caption settings no longer apply in the player. This screen replaces Accessibility › Captions. Someone who set those up loses them until they set the same style here. That's a deliberate trade-off: most Google TV devices hide that menu.
  • Captions move up while the info bar shows. They're drawn above the bar, not dimmed under its gradient.
  • The broadcaster's positions are kept. This is the same as before. As broadcast is the default.

How it works

  • CaptionStyling: turns the saved SubtitleStyle into a Media3 CaptionStyleCompat and text size. It also calls setApplyEmbeddedStyles(false) and setApplyEmbeddedFontSizes(false). Per Media3's source (SubtitleViewUtils.removeAllEmbeddedStyling), that clears window color, style spans and sizes, and keeps each cue's line and position. US broadcasts use those positions to keep captions clear of score bugs and on-screen names and titles (screenshot 5).
  • Always bottom: puts every text caption row, top row first, into one centered cue with no position, which Media3 draws at the bottom. Leaving the rows separate would draw them on top of each other. Each row's own alignment and horizontal position are dropped. Image-based (bitmap) subtitles are passed through unchanged.
  • Player: the PlayerView's own caption view is hidden. PlayerCaptions sends cues to a separate caption view, sized to the picture's frame inside the PlayerView. That view is placed above the info bar so the bar's dark gradient doesn't dim the captions, and below the side panels.
    • While the info bar shows, the view gets bottom padding of 34% of the picture's height.
    • Rows counted from the bottom (most broadcast captions) move up by that much. Rows counted from the top stay put. Cues positioned as a fraction of the height are squeezed into the top 66%.
  • Preview: a bundled photo (CC0, 85 KB WebP, source in third_party/images/SOURCES.md) with sample captions drawn by the same SubtitleView and CaptionStyling the player uses. The sample sits lower left the way a broadcaster places captions, so switching to Always bottom moves it visibly.
  • Storage: six new string keys in SettingsStore. A row hands the store a function from the saved value to the next one, and that function runs inside one DataStore edit, so two quick presses step twice. An unknown stored value falls back to the default.
  • Shared Settings pieces:
    • SettingRow, Segment, StepArrow, Hint and three size constants in SettingsScreen.kt go from private to internal, so the new screen reuses them.
    • SettingRow leaves out the description line when it's blank. Every existing row has one, so they don't change.
    • Segment gains an optional mark before its label, used for the color swatches.
    • New OpenRow and ActionButton helpers draw the "Customize ›" and "Reset ›" buttons.
  • Navigation: new route settings/subtitles. Settings returns focus to the Subtitles row on Back, like Favorites and Providers, and the top bar keeps Settings marked.

Verified

  • testDebugUnitTest, lintDebug and assembleRelease, each run on its own. The new SubtitleStyleTest covers:
    • defaults
    • the summary line
    • color and edge mapping
    • step limits
    • fallback for unknown stored values
    • the row-order key used by Always bottom
  • TopBarSectionTest checks that Subtitles keeps Settings marked. The merge itself (placeCues) builds Android text objects, so it's checked on the emulator, not in unit tests.
  • On the LiveWireTV_API34 emulator, signed in with the iptv-pool test login:
    • Every row changes the preview: size, color, background, edge, font, placement and reset.
    • Two quick ▶ presses on Text size go from Medium to Extra large.
    • Back returns to the Subtitles row in Settings, and the row's summary shows the new style.
    • Captions on NHL (MSG) and ESPN U College Football draw in the chosen style. With Always bottom they stack centered at the bottom. While the info bar shows they sit above it at full brightness.
    • With As broadcast, CBS Sports Network captions draw top left, where the broadcaster placed them.

Screenshots

  1. Settings row with a custom style
  2. Settings › Subtitles at the default style
  3. Large, yellow, outlined, Always bottom
  4. Player with the info bar showing: captions move up and are drawn above the bar
  5. Player at the default style: CBS Sports Network places its captions top left, clear of the score bug

Not tested

  • On a physical Android TV. Only the emulator was used.
  • Extra large text on a caption the broadcaster placed at the edge of the screen. Media3 keeps captions inside the frame, but no channel did this during testing.
  • Image-based (bitmap) subtitles. None of the tested channels had them.
## What changed Settings has a new **Subtitles** row (under Playback) that shows the current caption style and opens Settings › Subtitles. That screen has one row per caption setting and a preview on the right: - **Text size:** Small, Medium, Large, Extra large - **Text color:** White, Yellow, Cyan, Green - **Background:** Box, See-through, None - **Edge:** None, Outline, Shadow - **Font:** Default, Mono, Serif - **Placement:** As broadcast (default) or Always bottom - **Reset to default** ◀ ▶ change a row's value. OK cycles it forward and wraps (Extra large back to Small). Changes save at once and apply to the player straight away. This follows mockup option B in `design/mockups/bgrid/subtitles/`, with one change agreed during design review. The mockup's Position row (Bottom / Raised) became Placement (As broadcast / Always bottom). Raised is no longer a setting: captions move up on their own while the info bar shows. ## What looks different with no setting touched The default style is medium white text on a black box, the same as Media3's default. Even so, captions change for everyone in four ways: - **The broadcaster's colors, fonts and sizes are ignored.** The user's style always wins, so a broadcaster that colors a speaker's lines now shows them in the chosen color. - **Android's system caption settings no longer apply in the player.** This screen replaces Accessibility › Captions. Someone who set those up loses them until they set the same style here. That's a deliberate trade-off: most Google TV devices hide that menu. - **Captions move up while the info bar shows.** They're drawn above the bar, not dimmed under its gradient. - **The broadcaster's positions are kept.** This is the same as before. As broadcast is the default. ## How it works - **`CaptionStyling`:** turns the saved `SubtitleStyle` into a Media3 `CaptionStyleCompat` and text size. It also calls `setApplyEmbeddedStyles(false)` and `setApplyEmbeddedFontSizes(false)`. Per Media3's source (`SubtitleViewUtils.removeAllEmbeddedStyling`), that clears window color, style spans and sizes, and keeps each cue's line and position. US broadcasts use those positions to keep captions clear of score bugs and on-screen names and titles (screenshot 5). - **Always bottom:** puts every text caption row, top row first, into one centered cue with no position, which Media3 draws at the bottom. Leaving the rows separate would draw them on top of each other. Each row's own alignment and horizontal position are dropped. Image-based (bitmap) subtitles are passed through unchanged. - **Player:** the PlayerView's own caption view is hidden. `PlayerCaptions` sends cues to a separate caption view, sized to the picture's frame inside the PlayerView. That view is placed above the info bar so the bar's dark gradient doesn't dim the captions, and below the side panels. - While the info bar shows, the view gets bottom padding of 34% of the picture's height. - Rows counted from the bottom (most broadcast captions) move up by that much. Rows counted from the top stay put. Cues positioned as a fraction of the height are squeezed into the top 66%. - **Preview:** a bundled photo (CC0, 85 KB WebP, source in `third_party/images/SOURCES.md`) with sample captions drawn by the same `SubtitleView` and `CaptionStyling` the player uses. The sample sits lower left the way a broadcaster places captions, so switching to Always bottom moves it visibly. - **Storage:** six new string keys in `SettingsStore`. A row hands the store a function from the saved value to the next one, and that function runs inside one DataStore edit, so two quick presses step twice. An unknown stored value falls back to the default. - **Shared Settings pieces:** - `SettingRow`, `Segment`, `StepArrow`, `Hint` and three size constants in `SettingsScreen.kt` go from private to internal, so the new screen reuses them. - `SettingRow` leaves out the description line when it's blank. Every existing row has one, so they don't change. - `Segment` gains an optional mark before its label, used for the color swatches. - New `OpenRow` and `ActionButton` helpers draw the "Customize ›" and "Reset ›" buttons. - **Navigation:** new route `settings/subtitles`. Settings returns focus to the Subtitles row on Back, like Favorites and Providers, and the top bar keeps Settings marked. ## Verified - `testDebugUnitTest`, `lintDebug` and `assembleRelease`, each run on its own. The new `SubtitleStyleTest` covers: - defaults - the summary line - color and edge mapping - step limits - fallback for unknown stored values - the row-order key used by Always bottom - `TopBarSectionTest` checks that Subtitles keeps Settings marked. The merge itself (`placeCues`) builds Android text objects, so it's checked on the emulator, not in unit tests. - On the LiveWireTV_API34 emulator, signed in with the iptv-pool test login: - Every row changes the preview: size, color, background, edge, font, placement and reset. - Two quick ▶ presses on Text size go from Medium to Extra large. - Back returns to the Subtitles row in Settings, and the row's summary shows the new style. - Captions on NHL (MSG) and ESPN U College Football draw in the chosen style. With Always bottom they stack centered at the bottom. While the info bar shows they sit above it at full brightness. - With As broadcast, CBS Sports Network captions draw top left, where the broadcaster placed them. ## Screenshots 1. Settings row with a custom style 2. Settings › Subtitles at the default style 3. Large, yellow, outlined, Always bottom 4. Player with the info bar showing: captions move up and are drawn above the bar 5. Player at the default style: CBS Sports Network places its captions top left, clear of the score bug ## Not tested - On a physical Android TV. Only the emulator was used. - Extra large text on a caption the broadcaster placed at the edge of the screen. Media3 keeps captions inside the frame, but no channel did this during testing. - Image-based (bitmap) subtitles. None of the tested channels had them.
feat(subtitles): Customize how captions look in Settings › Subtitles
All checks were successful
CI / test (pull_request) Successful in 7m2s
b8e969565a
A Subtitles row in Settings opens a screen with text size, text color, background, edge, font and placement, plus a live preview drawn by the same Media3 caption view the player uses. Placement keeps the broadcaster's caption positions by default; Always bottom stacks them centered at the bottom. Captions move up while the player's info bar shows and are drawn above it.
Author
Owner

Intent: let viewers change how captions look (size, color, background, edge, font) and choose between the broadcaster's caption placement and always-bottom, with a preview that matches the player.

Not a goal:

  • Turning captions on or off. That stays in the player's Options › Subtitles.
  • Remembering the CC on/off choice between channels.
  • Captions in the Home and Guide channel previews.
  • Fixing caption timing or typos. Those come from the broadcaster.
**Intent:** let viewers change how captions look (size, color, background, edge, font) and choose between the broadcaster's caption placement and always-bottom, with a preview that matches the player. **Not a goal:** - Turning captions on or off. That stays in the player's Options › Subtitles. - Remembering the CC on/off choice between channels. - Captions in the Home and Guide channel previews. - Fixing caption timing or typos. Those come from the broadcaster.
fix(subtitles): Step from the saved value so quick presses don't collapse
All checks were successful
CI / test (pull_request) Successful in 6m26s
fa7000696f
Rows now hand the store a function from the saved value to the next one, run inside the DataStore edit, instead of a value computed from the last composed state.
namillis deleted branch feat/subtitle-style 2026-11-10 14:52:58 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
namillis/LiveWireTV!42
No description provided.