8000 feat(player): play the transcript as WebVTT caption tracks by adeelahmad · Pull Request #690 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(player): play the transcript as WebVTT caption tracks - #690

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn
Oct 19, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-xfmkzn

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: a video's captions were only an overlay the page drew, so the browser's captions menu, full screen, picture in picture and assistive technology never saw them, and the public page had no captions at all.

After: the <video> carries the transcript as a WebVTT <track kind="captions">, then each timed supplementary captions or translation file as another track (translations as subtitles).

  • Workspace: the Captions toggle (C) still draws the overlay. The track stays loaded but undrawn while the overlay shows, and the browser draws it only in full screen or picture in picture, so captions never show twice. Turning Captions off turns the track off.
  • Public page: no overlay, so the browser draws them. They are off when the page opens, as before, and a new Captions button turns them on.
  • Every track link is signed, so it works for visitors and share links. A share link gets the transcript track only, as in the Files tab.
  • GET /api/v1/recordings/<id>/player and GET /api/v1/public/recordings/<id> list the tracks as captions.

How: the tracks use IIIF's existing WebVTT routes (/iiif/<id>/transcript.vtt, /iiif/<id>/files/<fid>.vtt), signed with the existing iiif.sign for the media-link lifetime. A new CaptionTracks component renders them and sets each track's mode.

Motivation and Context

Item from the personal feature plan sheet (Library CSV export + captions <track>).

Screenshots (if appropriate):

n/a

Steps to reproduce (if appropriate):

Open a transcribed video, turn Captions on, then go full screen: the browser draws the transcript lines. On its public page, press Captions under the video.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests (tests/api/test_caption_tracks.py, __tests__/caption-tracks.test.tsx).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/video.md#captions, docs/access.md).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. Written as changelog.d/captions-track.md, per build(release): changelog fragments in changelog.d/ instead of one Unreleased section #581.

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI.
  • Agents: usable through the API, MCP or an assistant tool. Both player endpoints list the signed tracks.
  • Zero setup: no new prerequisite, .env edit or manual step.
  • Fewest clicks and keystrokes. The existing toggle and C drive the track; one button on the public page.
  • Configurable: new settings in the web app with defaults; wizard asks only what is required. n/a: no settings.
  • Light: default install still runs on a Raspberry Pi with cloud models. Serves existing WebVTT output.
  • Private and secure: data local and encrypted, passkeys, threat model updated. Reuses the IIIF signed links the threat model already lists ("media, report, embed, IIIF content"); offered only to readers who may read the asset and play its media.
  • Cost: cheapest path, model calls in the activity ledger, budgets respected. n/a: no model calls.
  • User decides: consequential or new actions wait for the user; defaults unchanged. Public pages open with captions off, as before.
  • Upgrades: existing installs upgrade safely (upgrade step for stored-data changes). Nothing stored changes.
  • Honest: sources cited; labelled built, in progress or planned. README built list and docs/requirements.md name the checks; "refine later" in docs/video.md (a translation picker in Lens's own controls; the audio-only embed).
  • Tests, docs and generated files updated (make openapi).
  • Open standards; dependencies keep Lens MIT. WebVTT and HTML <track>; no new dependencies.
  • Result reported with evidence; "refine later" items written down.
  • Reuse: existing Lens code and permissive libraries reused, nothing reinvented. Reuses IIIF WebVTT routes and signing.

Local CI: the container runs several times slower than usual, so I ran the changed tests directly: test_caption_tracks.py, test_iiif.py, test_public_pages.py, test_video.py (21 passed), caption-tracks.test.tsx (6 passed). ruff, mypy and tsc are clean, and make openapi shows no drift. GitHub CI decides the merge.


Generated by Claude Code

A video's <video> now carries its transcript as a <track kind="captions">,
and timed supplementary captions and translations as more tracks, in the
workspace player and on the public page. The tracks are IIIF's WebVTT with
links signed like media links, so visitors and share links can load them.

In the workspace the existing overlay still draws captions; the track stays
undrawn there and the browser draws it only in full screen or picture in
picture, so captions never show twice. The public page has no overlay: the
browser draws them, on by default, with a Captions button to turn them off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
@adeelahmad adeelahmad self-assigned this Oct 19, 2026
@adeelahmad
adeelahmad merged commit cf61138 into main Oct 19, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-xfmkzn branch October 19, 2026 16: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.

2 participants

0