01
HLS stream interception
The extension listens to network requests in the browser. When the player loads a subtitle playlist (.m3u8), the extension captures the URL and downloads all .vtt segments via the background service worker — this bypasses CORS restrictions.
02
Segment merging
HLS players split subtitles into fragments of 5–10 seconds each. The extension downloads them all and merges into a single text, removing duplicates at segment boundaries.
03
Batched translation
The text is split into batches of 100 lines and sent to the AI model. The first batch is 50 lines so subtitles appear faster. Each batch is translated preserving line numbers and context.
04
Caching
The finished translation is saved locally and on the server. On repeat viewing, subtitles appear instantly. Best model wins: an Opus translation replaces Sonnet.
05
Rendering over video
Subtitles are rendered over the video in real time via requestAnimationFrame. The player's native subtitles are hidden. Dual subtitles (original + translation) and timing adjustment are supported.