Skip to content

feat: in-player subtitles — c toggles captions (Phase 4)#27

Merged
detain merged 1 commit into
masterfrom
feat/subtitles
Jun 23, 2026
Merged

feat: in-player subtitles — c toggles captions (Phase 4)#27
detain merged 1 commit into
masterfrom
feat/subtitles

Conversation

@detain

@detain detain commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Phase 4 — subtitle overlay, part 3 of 3 (client)

Wires the sugar-reel WebVtt parser (sugarcraft#1099) + the server endpoint (phlix-server#306) into the player.

Behaviour

  • c lazily fetches the item's subtitle tracks (GET /media/{id}/subtitles), picks the default (or first), fetches that track's WebVTT (GET /media/{id}/subtitles/{index}), and parses it with sugar-reel's WebVtt. Afterwards c just flips visibility.
  • The active cue (cueAt(position)) is rendered centered on a caption line above the scrubber; the status hint shows c cc✓ when on.
  • Best-effort: no tracks or a failed fetch just leaves captions off (a second c doesn't refetch).
  • CHROME_ROWS 3 → 4 — a caption row is always reserved, so toggling captions never reflows/resizes the video.

Pieces

  • SubtitleTrack DTO; ApiClient::subtitleTracks (JSON) + ApiClient::subtitleVtt (raw text/vtt body, no refresh-retry); SubtitleVttLoadedMsg.

Tests — 366 → 384 green

PlayerScreen 98.3% (uncovered = pre-existing defensive guards), ApiClient 98.0%, SubtitleTrack 100%. Covers toggle-on→fetch→show-active-cue, toggle-off-hides, cue-gap (nothing shown), no-tracks (stays off, no refetch), swallowed fetch failure; ApiClient track mapping + raw VTT body + non-2xx throws.

Visual rendering is verified by the maintainer (bin/phlix run); the fetch/parse/toggle/compositing logic is covered headlessly here.

🤖 Generated with Claude Code

Pressing c in the player lazily fetches the item's subtitle tracks
(GET /media/{id}/subtitles), picks the default (or first), fetches that track's
WebVTT (GET /media/{id}/subtitles/{index}) and parses it with sugar-reel's
WebVtt; the active cue is then centered on a caption line above the scrubber, and
c flips it on/off. All best-effort — no tracks or a failed fetch just leaves
captions off. A caption row is always reserved so toggling never reflows the
video.

384 tests; PlayerScreen 98.3%, SubtitleTrack 100%.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@detain detain merged commit 9f4240a into master Jun 23, 2026
1 check passed
@detain detain deleted the feat/subtitles branch June 23, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant