Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
feat(website): let the reader drive the picture with the scroll wheel
Etienne Lescot830713ce76d0
diff --git a/website/docs/ai-editing.md b/website/docs/ai-editing.mdindex 93d88e9dd..06dd4fd3b 100644--- a/website/docs/ai-editing.md+++ b/website/docs/ai-editing.md@@ -13,10 +13,10 @@ keywords:# AI editing-OpenScreen ships an optional agent that edits your project from a chat panel. It is **off until you connect a provider yourself**, and it is the only part of the app that talks to a network.+OpenScreen ships an optional agent that edits your project from a chat panel. It is **off until you connect a provider yourself**, and apart from the one-time Whisper model download, it is the only part of the app that talks to a network.:::tip-None of this is required. Recording, editing, transcription, captions, and export all work with zero network access and no account, whether or not you ever open the chat panel.+None of this is required. Recording, editing, transcription, captions, and export all work with no account and no provider, whether or not you ever open the chat panel — the only network any of them touches is the [one-time Whisper model download](./captions.md#transcribing) on your first transcription.:::## Connecting a providerdiff --git a/website/docs/captions.md b/website/docs/captions.mdindex 9d7c14a23..ce2fa849a 100644--- a/website/docs/captions.md+++ b/website/docs/captions.md@@ -14,7 +14,7 @@ keywords:# Captions & transcript-OpenScreen transcribes your recording's audio **entirely on-device** — nothing is uploaded, and it works offline. That one transcript is then the source for two things: the captions burned into your video, and a text view you can edit your recording from.+OpenScreen transcribes your recording's audio **entirely on-device** — your audio is never uploaded, and once the model is on disk it works offline. That one transcript is then the source for two things: the captions burned into your video, and a text view you can edit your recording from.## Transcribing@@ -23,7 +23,7 @@ Every clip carries its own transcript. Run it either way:- From the **Media** stage — select an asset card and hit **Regenerate**. This is also where you force a language (Auto, English, French, Spanish) instead of letting Whisper detect it, and where per-asset status lives (Pending, Transcribing, Generated, Failed).- From the **Captions** facet in the editor's inspector — **Transcribe video** runs the same pipeline on the current media.-The first run downloads a local Whisper model (~264 MB, SHA-256 verified, written atomically so a half-download can never be picked up). After that, transcription is fully offline. It runs natively — whisper.cpp with a GPU backend picked at runtime: Metal on Apple Silicon, Vulkan on Windows and Linux, CPU everywhere else.+The whisper.cpp engine ships inside the app; the model does not. The first run downloads it from huggingface.co (~264 MB, SHA-256 verified, written atomically so a half-download can never be picked up) — the one moment transcription needs a network. After that it is fully offline, on a GPU backend picked at runtime: Metal on Apple Silicon, Vulkan on Windows and Linux, CPU everywhere else.Word timings come from Whisper's own DTW token timestamps, then get re-anchored on the audio itself — every boundary is pulled back to the quietest moment just before it. This is what makes a transcript-driven cut land where the word actually starts instead of a syllable late.@@ -42,7 +42,7 @@ Open the **Captions** facet in the inspector:| **Position** | Top / Middle / Bottom, left / center / right alignment, a fine vertical offset, and band width as a % of the frame. || **Line length** | Min and max words per line (1–12). Lines are packed inside that range. |-Size is expressed in pixels at a 1080-high frame and scales with the real output, so captions look the same at 720p, 1080p, or source. Preview and export share the same layout code — what you see is what gets burned in.+Size is expressed in pixels at a 1080-high frame and scales with the real output, so captions look the same at 720p, 1080p, or source. Preview and export share the same layout code — what you see is what gets burned in. Burned in is the only form they take: OpenScreen writes no sidecar `.srt` or `.vtt`, so captions can't be turned off by whoever watches the file.### Translationdiff --git a/website/docs/export.md b/website/docs/export.mdindex e0cad0739..b62981808 100644--- a/website/docs/export.md+++ b/website/docs/export.md@@ -43,12 +43,12 @@ If something fails during render or write, the dialog shows the error so you can## How MP4 is rendered-MP4 export runs through the same native Rust + Direct3D 11 compositor that draws the live preview, one clip at a time, on a single GPU device: demux → decode → composite → hardware encode → mux, with no CPU readback in between. The preview pauses itself for the duration so the two aren't fighting over the GPU.+MP4 export runs through the same native Rust compositor that draws the live preview — Direct3D 11 on Windows, Metal on macOS, wgpu/WGSL on Linux — one clip at a time, on a single GPU device: demux → decode → composite → encode → mux. On Windows and macOS the encoder takes the composed frame straight off the GPU, with no CPU readback in between; on Linux the frame is read back and encoded in software. The preview pauses itself for the duration so the two aren't fighting over the GPU.Because preview and export consume the same scene description, the frame you're looking at is the frame you get — there is no separate export renderer that could drift.-:::warning Platform support-The native compositor is **Windows-only today**, so MP4 export currently requires Windows. GIF export has its own renderer-side path and works on all three platforms. See the [roadmap](https://github.com/getopenscreen/openscreen/blob/main/ROADMAP.md) for status.+:::note Platform support+MP4 and GIF export both work on Windows, macOS, and Linux. The one difference left is speed: the Linux encode is software rather than hardware today, so the same export takes longer there. See the [roadmap](https://github.com/getopenscreen/openscreen/blob/main/ROADMAP.md) for status.:::## Exported file vs. project filediff --git a/website/docs/installation.md b/website/docs/installation.mdindex 0184d9bb4..4a7e87809 100644--- a/website/docs/installation.md+++ b/website/docs/installation.md@@ -100,7 +100,7 @@ You may need to grant screen-recording permission depending on your desktop envi## Platform differences-The editing tools are the same everywhere — zooms, backgrounds, crop/trim/speed, annotations, transcription, captions, and projects. **Capture** and **MP4 export** differ:+The editing tools are the same everywhere — zooms, backgrounds, crop/trim/speed, annotations, transcription, captions, and projects. Every export format works on every platform; what differs is **capture**, and how fast MP4 encodes on Linux:| | macOS | Windows | Linux ||---|---|---|---|@@ -108,12 +108,12 @@ The editing tools are the same everywhere — zooms, backgrounds, crop/trim/spee| Custom cursor themes / click effects | ✅ | ✅ | ❌ (position-only, used for auto-zoom) || Webcam | Native capture | Native capture | Browser capture (still works as PiP) || System audio | macOS 13+; permission prompt on 14.2+; not available on macOS 12 and below | Works out of the box | Needs PipeWire (default on Ubuntu 22.04+, Fedora 34+) |-| MP4 export | ❌ not yet | ✅ | ❌ not yet |+| MP4 export | ✅ | ✅ | ✅ (software encode) || GIF export | ✅ | ✅ | ✅ || On-device transcription | Metal (Apple Silicon) / CPU | Vulkan / CPU | Vulkan / CPU |-:::warning MP4 export is Windows-only for now-The GPU compositor behind the live preview and MP4 export is built on Direct3D 11 and currently ships only in the Windows build. Recording, editing, and GIF export work on all three platforms; MP4 export does not yet. Track it on the [roadmap](https://github.com/getopenscreen/openscreen/blob/main/ROADMAP.md).+:::note MP4 export on Linux+The GPU compositor behind the live preview and MP4 export has three backends — Direct3D 11 on Windows, Metal on macOS, wgpu/WGSL on Linux — and ships in all three builds. The Linux one encodes in software rather than on the GPU, so an export there takes longer than the same one on Windows or macOS; hardware encode is tracked on the [roadmap](https://github.com/getopenscreen/openscreen/blob/main/ROADMAP.md).:::Next: [Quick start](./quick-start.md) walks through your first recording.diff --git a/website/docs/intro.md b/website/docs/intro.mdindex 3db3a65be..2c404220b 100644--- a/website/docs/intro.md+++ b/website/docs/intro.md@@ -15,7 +15,7 @@ keywords:# Welcome to OpenScreen-OpenScreen is a **free, open-source screen recorder and editor**. It uses native capture APIs (ScreenCaptureKit on macOS, Windows Graphics Capture on Windows) for low-overhead recording, and composites both the live preview and the final export on the GPU through a native Rust + Direct3D 11 renderer — one path, so what you see in the editor is what comes out of the export.+OpenScreen is a **free, open-source screen recorder and editor**. It uses native capture APIs (ScreenCaptureKit on macOS, Windows Graphics Capture on Windows) for low-overhead recording, and composites both the live preview and the final export on the GPU through a native Rust renderer (Direct3D 11 on Windows, Metal on macOS, wgpu on Linux) — one path, so what you see in the editor is what comes out of the export.:::warningOpenScreen is **not production-grade**. The project is in active development and rough edges are expected.@@ -31,7 +31,7 @@ OpenScreen is **not production-grade**. The project is in active development and- [Export](./export.md) to MP4 (720p/1080p/source, H.264 or H.265) or animated GIF.:::note-Recording, editing, transcription, captions, and export all work fully offline with no account. AI chat editing and caption translation are the only features that talk to a network — and only once you connect a provider yourself.+Recording, editing, transcription, captions, and export all work offline with no account. The one exception is the first transcription you ever run, which downloads its Whisper model (~264 MB) once — after that, transcription is offline too. AI chat editing and caption translation are the only features that keep talking to a network, and only once you connect a provider yourself.:::## Project factsdiff --git a/website/scripts/check-media-budget.mjs b/website/scripts/check-media-budget.mjsindex bfe6d3604..39d64c1d5 100644--- a/website/scripts/check-media-budget.mjs+++ b/website/scripts/check-media-budget.mjs@@ -19,15 +19,30 @@* for a large share of visitors, and looks perfect on the machine that made it.*/-import { readdirSync, readFileSync, statSync } from "node:fs";+import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";import { join, relative, resolve } from "node:path";const ROOT = resolve(import.meta.dirname, "..");const RULES = [- { dir: "static/video", ext: ".mp4", max: 200_000 },- { dir: "static/img/walkthrough", ext: ".jpg", max: 70_000 },+ { dir: "static/video", ext: [".mp4"], max: 200_000 },+ { dir: "static/img/walkthrough", ext: [".jpg", ".avif"], max: 70_000 },];++/**+ * A `-scrub` clip is a different kind of file and gets a different ceiling.+ *+ * It is never played; scroll position seeks it. A seek into a long GOP has to+ * decode from the preceding keyframe, so these are encoded all-intra — every+ * frame its own keyframe — which is the entire reason they are large. Measured+ * on the export beat at 960x540: 32 KB at `-g 60`, 402 KB all-intra at 30fps,+ * 268 KB once dropped to 20fps. Twenty frames a second is finer than a scroll+ * resolves, and it is where this ceiling was set.+ *+ * The generous per-file number is safe because TOTAL_MAX is the rule that+ * actually protects the repository, and it did not move.+ */+const SCRUB_MAX = 300_000;const TOTAL_MAX = 1_600_000;const problems = [];@@ -63,6 +78,29 @@ function hasAudioTrack(file) {return false;}+/**+ * Why an AVIF might not belong. It is offered *ahead of* the JPEG and never+ * instead of it — an engine that cannot decode AVIF falls through to the same+ * <picture>'s JPEG, and the schema.org screenshot points at the JPEG as well —+ * so the pair only pays for itself while the AVIF is the smaller of the two. An+ * encoder run that came out heavier would hand every modern browser the worse+ * file, and the JPEG would still be in git behind it: two costs for no win.+ */+function avifProblem(file, bytes) {+ const fallback = file.replace(/\.avif$/, ".jpg");+ if (!existsSync(fallback)) {+ return "has no .jpg beside it — engines without AVIF would have nothing to fall back to";+ }+ const fallbackBytes = statSync(fallback).size;+ if (bytes >= fallbackBytes) {+ return (+ `${bytes.toLocaleString()} B is no smaller than its ${fallbackBytes.toLocaleString()} B ` ++ `JPEG. Re-encode it lower, or drop the AVIF and ship the JPEG alone.`+ );+ }+ return null;+}+for (const rule of RULES) {const abs = join(ROOT, rule.dir);for (const file of walk(abs)) {@@ -71,16 +109,21 @@ for (const rule of RULES) {total += bytes;counted += 1;- if (!file.endsWith(rule.ext)) {- problems.push(`${rel}: unexpected file type in ${rule.dir} (only ${rule.ext} belongs here)`);+ if (!rule.ext.some((e) => file.endsWith(e))) {+ problems.push(+ `${rel}: unexpected file type in ${rule.dir} (only ${rule.ext.join(" or ")} belongs here)`,+ );continue;}- if (bytes > rule.max) {+ const ceiling = /-scrub(-sm)?\.mp4$/.test(file) ? SCRUB_MAX : rule.max;+ if (bytes > ceiling) {problems.push(- `${rel}: ${bytes.toLocaleString()} B exceeds the ${rule.max.toLocaleString()} B ceiling`,+ `${rel}: ${bytes.toLocaleString()} B exceeds the ${ceiling.toLocaleString()} B ceiling`,);}- if (rule.ext === ".mp4" && hasAudioTrack(file)) {+ const avifFault = file.endsWith(".avif") && avifProblem(file, bytes);+ if (avifFault) problems.push(`${rel}: ${avifFault}`);+ if (file.endsWith(".mp4") && hasAudioTrack(file)) {problems.push(`${rel}: carries an audio track. Re-encode with -an — iOS Safari refuses ` +`gesture-free autoplay for media that has one, muted or not.`,diff --git a/website/src/components/Walkthrough/bands.ts b/website/src/components/Walkthrough/bands.tsindex 9ad0a7a1a..547669031 100644--- a/website/src/components/Walkthrough/bands.ts+++ b/website/src/components/Walkthrough/bands.ts@@ -23,6 +23,24 @@ export type BandMedia = {resultSm?: string;clip?: string;clipSm?: string;+ /**+ * The scroll-driven rendition, where one exists.+ *+ * A different encode of the same footage, not the same file: scrubbing seeks+ * rather than plays, and a seek into a long GOP has to decode from the+ * preceding keyframe, so the shipped `clip` (`-g 60`) stutters under a+ * scrollwheel. These are all-intra — every frame its own keyframe — which+ * makes a seek exact and cheap and costs 8.4x the bytes at 30fps. Measured on+ * the export beat: 32 KB at -g 60, 402 KB all-intra. Dropping to 20fps takes+ * that to 268 KB, and 20fps is more than a scroll can resolve: a beat spans+ * roughly a viewport and a half of scrolling, so a frame lands every ~15px.+ */+ scrub?: {+ clip: string;+ clipSm: string;+ seconds: number;+ frames: number;+ };/** Intrinsic size of the desktop asset. Both are needed on the <img> or the* page reflows when it lands; `aspect-ratio` alone loses Safari 14. */width: number;@@ -60,8 +78,8 @@ export const BANDS: Band[] = [index: "01",kicker: "record",claim: "It records with the operating system, not around it.",- body: "Pick a window, a display, or a region. macOS goes through ScreenCaptureKit and Windows through Windows Graphics Capture — the same capture path the system uses itself. The pointer is recorded as data rather than burned into the pixels, so you can restyle it after the fact.",- fact: "ScreenCaptureKit · Windows Graphics Capture · system audio on its own track",+ body: "Pick a window or a display. macOS goes through ScreenCaptureKit and Windows through Windows Graphics Capture — the same capture path the system uses itself. The pointer is recorded as data rather than burned into the pixels, so you can restyle it after the fact.",+ fact: "ScreenCaptureKit · Windows Graphics Capture · system audio without extra drivers",shape: "statement",},{@@ -79,7 +97,7 @@ export const BANDS: Band[] = [height: 288,widthSm: 640,heightSm: 118,- alt: "The OpenScreen timeline: a ruler in minutes and seconds, two green zoom blocks labelled 1.80x and 2.20x sitting on their own lane, prompts reading “Press A to add annotation”, “Press S to add speed” and “Press T to add trim” on the empty lanes below, and one audio clip drawn as a waveform along the bottom.",+ alt: "The OpenScreen timeline: a ruler in minutes and seconds, then prompts reading “Press A to add annotation”, “Press S to add speed” and “Press T to add trim” on empty lanes, then two green zoom blocks labelled 1.80x and 2.20x sharing one lane below them, then “Press C to add a Full Camera segment”, and one audio clip drawn as a waveform along the bottom.",},},{@@ -87,8 +105,8 @@ export const BANDS: Band[] = [index: "03",kicker: "captions",claim: "Transcription runs on your machine.",- body: "Whisper is bundled. The audio never leaves the laptop, it works with the network off, and what comes back is editable text — set the typeface, the size, the colour, the position. Burn it into the render, or keep it as a track you can hand to someone else.",- fact: "whisper.cpp · offline · Metal, CUDA or CPU",+ body: "whisper.cpp ships with the app, and the model downloads once on first use — after that it works with the network off. The audio never leaves the laptop, and what comes back is editable text — set the typeface, the size, the colour, the position, then burn it into the render. Delete a word from the transcript and that span is cut from the video too.",+ fact: "whisper.cpp · offline after first run · Metal, Vulkan or CPU",shape: "plate",media: {image: `${IMG}/03-captions-a.jpg`,@@ -105,13 +123,19 @@ export const BANDS: Band[] = [index: "04",kicker: "agent",claim: "Or describe the edit instead.",- body: "The agent reads the actual transcript and the actual timeline, so it answers with timecodes you can go and check — which spans it will cut, and how much that saves. It proposes; you accept. Every edit it makes is an ordinary undoable one, and it needs a provider key you supply. Nothing runs until you connect one.",+ body: "The agent reads the actual transcript and the actual timeline, so it answers with timecodes you can go and check — which spans it will cut, and how much that saves. It makes the edit, then tells you exactly what it changed — or, with Project edits switched off in Settings → AI, it describes the cut and waits for your word. Every edit it makes is an ordinary undoable one, and it needs a provider key you supply. Nothing runs until you connect one.",fact: "bring your own key · off by default · every edit is undoable",shape: "plate",flip: true,media: {image: `${IMG}/04-agent-a.jpg`,imageSm: `${IMG}/04-agent-sm-a.jpg`,+ scrub: {+ clip: `${VID}/04-agent-scrub.mp4`,+ clipSm: `${VID}/04-agent-sm-scrub.mp4`,+ seconds: 2.75,+ frames: 56,+ },width: 960,height: 540,widthSm: 640,@@ -124,7 +148,7 @@ export const BANDS: Band[] = [index: "05",kicker: "export",claim: "Then it writes the file.",- body: "MP4 or GIF, 720p to source, 24 or 30 or 60, H.264 or H.265. The encode runs on your machine and counts frames while it does. No queue, no account, no watermark. The file is on disk when the bar fills.",+ body: "MP4 at 720p to source, 24 or 30 or 60, H.264 or H.265 — or a GIF. The encode runs on your machine and counts frames while it does. No queue, no account, no watermark. The file is on disk when the bar fills.",fact: "H.264 / H.265 · 24, 30, 60 fps · no watermark",// A plate, not a letterbox: the export dialog is already close to 16:9,// and cropping it to a 3.5:1 strip cuts the format row off the top and the@@ -137,6 +161,12 @@ export const BANDS: Band[] = [resultSm: `${IMG}/05-export-sm-b.jpg`,clip: `${VID}/05-export.mp4`,clipSm: `${VID}/05-export-sm.mp4`,+ scrub: {+ clip: `${VID}/05-export-scrub.mp4`,+ clipSm: `${VID}/05-export-sm-scrub.mp4`,+ seconds: 3.2,+ frames: 64,+ },width: 960,height: 540,widthSm: 640,diff --git a/website/src/components/Walkthrough/index.tsx b/website/src/components/Walkthrough/index.tsxindex dbb6294bd..181c0e9d5 100644--- a/website/src/components/Walkthrough/index.tsx+++ b/website/src/components/Walkthrough/index.tsx@@ -6,14 +6,126 @@ import { BANDS, type Band } from "./bands";import { PLATE } from "./plate";import styles from "./styles.module.css";import { type BandPlayback, useBandPlayback } from "./useBandPlayback";+import { useScrub, useScrubEnabled } from "./useScrub";++/**+ * Decides the layout before the first paint rather than after hydration.+ *+ * The pinned layout makes its band about two viewports tall. Switching to it+ * once React has mounted would move every section below it, which is a layout+ * shift with no user interaction to excuse it — exactly what CLS counts. An+ * attribute set from the document head costs one synchronous statement and is+ * in place before anything is painted.+ *+ * `position: sticky` is checked as well as the motion preference: it is the one+ * capability the layout cannot do without, and an engine that lacks it would+ * otherwise be handed a two-viewport-tall band with a picture stranded at the+ * top of it.+ */+const SCRUB_GATE = `try{var m=matchMedia('(prefers-reduced-motion: reduce)').matches,+w=matchMedia('(min-width: 901px)').matches,s=CSS.supports('position','sticky');+document.documentElement.setAttribute('data-os-scrub',!m&&w&&s?'on':'off')}catch(e){}`;/** Both global controls are server-rendered as inert spans of identical box size* and upgraded after hydration, so a reader without JavaScript never meets a- * control that looks operable and is not. */-function useUpgradedTag(hydrated: boolean) {+ * control that looks operable and is not. Deliberately not named `use…`: it is a+ * ternary, it is called after an early return, and a hook-shaped name is how a+ * later refactor talks itself into putting state inside it. */+function upgradedTag(hydrated: boolean) {return hydrated ? "button" : "span";}+/**+ * A band the reader scrubs: the figure pins, the band is taller than the+ * viewport, and scroll position walks the clip. There is no Play control and no+ * dwell timer — the scroll *is* the transport, in both directions, and a reader+ * who stops gets a still frame rather than something that carries on without+ * them. The poster stays underneath and is what shows until the clip can seek.+ */+function ScrubBand({ band }: { band: Band }) {+ const media = band.media!;+ const scrub = media.scrub!;+ const bandRef = useRef<HTMLElement | null>(null);+ const videoRef = useRef<HTMLVideoElement | null>(null);+ const enabled = useScrubEnabled();+ const [small, setSmall] = useState(false);+ useEffect(() => {+ const mq = window.matchMedia("(max-width: 780px)");+ const sync = () => setSmall(mq.matches);+ sync();+ mq.addEventListener("change", sync);+ return () => mq.removeEventListener("change", sync);+ }, []);+ const { progress, ready, near } = useScrub({+ band: bandRef,+ video: videoRef,+ seconds: scrub.seconds,+ enabled,+ });++ return (+ <article+ id={band.id}+ ref={bandRef}+ className={`${styles.band} ${styles.split} ${band.flip ? styles.flip : ""} ${styles.scrubbable}`}+ >+ <Copy band={band} />+ <figure className={styles.figure}>+ <div+ className={styles.frame}+ style={{ aspectRatio: `${media.width} / ${media.height}` }}+ >+ <picture>+ <source media="(max-width: 780px)" srcSet={media.imageSm} />+ <img+ className={styles.still}+ src={media.image}+ width={media.width}+ height={media.height}+ loading="lazy"+ decoding="async"+ alt={media.alt}+ />+ </picture>+ {enabled && near && (+ <video+ ref={videoRef}+ className={`${styles.clip} ${ready ? styles.clipReady : ""}`}+ src={small ? scrub.clipSm : scrub.clip}+ width={media.width}+ height={media.height}+ muted+ playsInline+ preload="auto"+ aria-hidden="true"+ tabIndex={-1}+ disableRemotePlayback+ />+ )}+ </div>+ {/* Both captions are rendered and CSS shows one, because which is true+ depends on a capability the server cannot know. Swapping the text+ after hydration would say "Scroll to run it" to a reader for whom it+ is false, for as long as the bundle takes to arrive. */}+ <figcaption className={styles.caption}>+ <span className={`${styles.captionText} ${styles.captionScrub}`}>+ Scroll to run it · {scrub.frames} frames+ </span>+ <span className={`${styles.captionText} ${styles.captionStill}`}>+ A frame of the running application+ </span>+ </figcaption>+ <span className={`${styles.rail} ${styles.railScrub}`} aria-hidden="true">+ <span+ className={styles.railFill}+ style={{ transform: `scaleX(${progress.toFixed(4)})` }}+ />+ </span>+ </figure>+ </article>+ );+}+function BandView({ band, ctl }: { band: Band; ctl: BandPlayback }) {const { media } = band;const videoRef = useRef<HTMLVideoElement | null>(null);@@ -25,7 +137,7 @@ function BandView({ band, ctl }: { band: Band; ctl: BandPlayback }) {const refused = ctl.refusedIds.has(band.id);// Depending on `ctl` itself would re-run this on every render — it is a fresh// object each time — and call play() again on an element already playing.- const { markRefused } = ctl;+ const { markRefused, playToken, small } = ctl;useEffect(() => {if (!owns) {@@ -35,14 +147,29 @@ function BandView({ band, ctl }: { band: Band; ctl: BandPlayback }) {}const el = videoRef.current;if (!el) return;+ let live = true;+ // `playToken` and `small` are dependencies for the same reason: neither one+ // moves `owns`, and both mean the element has to start over. The second is+ // the less obvious one — changing `src` runs the resource-selection+ // algorithm, which rewinds to 0 and pauses without firing `pause`, so+ // nothing else on the page would ever learn that playback had stopped.+ el.currentTime = 0;const attempt = el.play();if (attempt) {- // iOS in Low Power Mode refuses muted inline autoplay outright, and the- // page cannot override it. The poster and the labelled button stay; only- // the element goes away.- attempt.catch(() => markRefused(band.id));+ attempt.catch((err: DOMException) => {+ // iOS in Low Power Mode refuses muted inline autoplay outright, and+ // the page cannot override it. The poster and the labelled button+ // stay; only the element goes away. An AbortError claims nothing of+ // the sort — the band lost the element, or swapped rendition, while+ // the clip was still loading — and filing it as a refusal deletes+ // the only control the section has over its own motion.+ if (live && err?.name === "NotAllowedError") markRefused(band.id);+ });}- }, [owns, band.id, markRefused]);+ return () => {+ live = false;+ };+ }, [owns, band.id, markRefused, playToken, small]);if (!media) {return (@@ -66,7 +193,7 @@ function BandView({ band, ctl }: { band: Band; ctl: BandPlayback }) {const alt = showResult && media.resultAlt ? media.resultAlt : media.alt;const hasClip = !!media.clip;- const Tag = useUpgradedTag(ctl.hydrated);+ const Tag = upgradedTag(ctl.hydrated);const label = played ? `Replay the ${band.kicker} clip` : `Play the ${band.kicker} clip`;return (@@ -75,11 +202,17 @@ function BandView({ band, ctl }: { band: Band; ctl: BandPlayback }) {className={`${styles.band} ${band.shape === "letterbox" ? styles.wide : styles.split} ${band.flip ? styles.flip : ""}`}- ref={ctl.registerBand(band.id)}- data-band-id={band.id}><Copy band={band} />- <figure className={styles.figure}>+ {/* The observer watches the picture, not the band. A stacked band on a+ landscape phone is taller than the viewport, so its intersection+ ratio cannot reach the threshold at all and the clip never starts+ however long the reader sits on it. The figure always fits. */}+ <figure+ className={styles.figure}+ ref={ctl.registerBand(band.id)}+ data-band-id={band.id}+ ><divclassName={styles.frame}style={{ aspectRatio: `${media.width} / ${media.height}` }}@@ -100,7 +233,7 @@ function BandView({ band, ctl }: { band: Band; ctl: BandPlayback }) {<videoref={videoRef}className={`${styles.clip} ${ready ? styles.clipReady : ""}`}- src={ctl.small ? media.clipSm : media.clip}+ src={small ? media.clipSm : media.clip}width={media.width}height={media.height}muted@@ -111,6 +244,10 @@ function BandView({ band, ctl }: { band: Band; ctl: BandPlayback }) {disableRemotePlaybackonLoadedData={() => setReady(true)}onPlaying={() => setPlaying(true)}+ onEmptied={() => {+ setReady(false);+ setPlaying(false);+ }}onEnded={() => {setPlaying(false);ctl.markPlayed(band.id);@@ -166,11 +303,13 @@ function Copy({ band }: { band: Band }) {export default function Walkthrough() {const ctl = useBandPlayback();- const Tag = useUpgradedTag(ctl.hydrated);+ const scrubbing = useScrubEnabled();+ const Tag = upgradedTag(ctl.hydrated);return (<><Head>+ <script>{SCRUB_GATE}</script><linkrel="preload"as="image"@@ -190,7 +329,12 @@ export default function Walkthrough() {sizes={PLATE.sizes}width={PLATE.width}height={PLATE.height}- fetchPriority="high"+ // react-dom 18 does not recognise the camelCase prop it learns in 19,+ // and logs an unknown-prop error for it on every dev load of the+ // landing page. Both spellings serialise to fetchpriority="high";+ // the spread is only what gets the lowercase one past @types/react,+ // which is already on 19.+ {...{ fetchpriority: "high" }}decoding="async"alt={PLATE.alt}/>@@ -229,7 +373,11 @@ export default function Walkthrough() {? {type: "button" as const,"aria-pressed": ctl.autoplay,- onClick: () => ctl.setAutoplay(!ctl.autoplay),+ // Turning it off has to stop the clip that is running and+ // the one that is 400ms from starting, or the control+ // reports a state the page has not entered.+ onClick: () =>+ ctl.autoplay ? ctl.stopAutoplay() : ctl.setAutoplay(true),}: { "aria-hidden": true })}>@@ -239,9 +387,16 @@ export default function Walkthrough() {</div></div>- {BANDS.map((band) => (- <BandView key={band.id} band={band} ctl={ctl} />- ))}+ {/* Which component renders a band is decided by the data, not by a+ capability — the server and the client must agree, and the pinned+ layout is turned on and off in CSS alone. */}+ {BANDS.map((band) =>+ band.media?.scrub ? (+ <ScrubBand key={band.id} band={band} />+ ) : (+ <BandView key={band.id} band={band} ctl={ctl} />+ ),+ )}</div></section></>diff --git a/website/src/components/Walkthrough/styles.module.css b/website/src/components/Walkthrough/styles.module.cssindex 8f6389098..a0ac44e6f 100644--- a/website/src/components/Walkthrough/styles.module.css+++ b/website/src/components/Walkthrough/styles.module.css@@ -190,8 +190,15 @@cursor: pointer;}-span.toggle {+/* The pre-hydration form, to the pixel the same box so nothing shifts when the+ real control replaces it — but visibly not a control. The border and the fill+ carry that, never the text alpha: dimming the label takes it to 2.8:1 in the+ dark theme and 2.3:1 in the light one, which trades a nit for a 1.4.3 failure. */+span.toggle,+span.replay {cursor: default;+ border-style: dashed;+ background: none;}.toggle[aria-pressed="true"] {@@ -212,6 +219,21 @@ span.toggle {box-shadow: 0 0 0 3px var(--os-accent-soft);}+/* Forced colors paints both dots in Canvas and drops the box-shadow, so on and+ off render identically — and with the dot gone the pill does not read as a+ toggle at all. Border width is not a colour, so it survives: hollow ring off,+ filled disc on, and 3px on a 7px border-box dot fills it without reflow. */+@media (forced-colors: active) {+ .toggleDot {+ box-sizing: border-box;+ border: 1px solid CanvasText;+ }++ .toggle[aria-pressed="true"] .toggleDot {+ border-width: 3px;+ }+}+/* ---- bands ---- */.band {@@ -314,6 +336,51 @@ span.toggle {/* ---- the plate itself ---- */+/* ---- the scrubbed bands ----+ A band with a scroll rendition becomes its own theatre: it grows to a little+ over two viewports, and both its halves pin, so scrolling through it walks the+ clip a frame at a time in whichever direction the reader is going.++ Every rule here hangs off one attribute set in the document head before the+ first paint. Turn it off — reduced motion, a narrow screen, no `sticky`, no+ JavaScript at all — and the band is an ordinary picture beside an ordinary+ paragraph, which is the layout the rest of the section already uses. That is+ the whole reason the pin is per band rather than one stage held across the+ page: there is no second layout to maintain and nothing to swap at runtime. */++:global([data-os-scrub="on"]) .scrubbable {+ /* The clip's length in scroll. Roughly a viewport and a quarter of travel+ over a 64-frame clip puts a frame every ~15px, which is finer than a+ trackpad gesture resolves and about half what a wheel notch jumps. */+ min-height: 225vh;+ align-items: start;+}++:global([data-os-scrub="on"]) .scrubbable .copy,+:global([data-os-scrub="on"]) .scrubbable .figure {+ position: sticky;+ /* Centred on the viewport where there is room, and never under the 60px+ navbar where there is not. */+ top: max(88px, calc(50vh - 250px));+}++:global([data-os-scrub="on"]) .captionStill,+:global([data-os-scrub="off"]) .captionScrub,+:global([data-os-scrub="off"]) .railScrub {+ display: none;+}++/* Before the gate script runs — and for a reader with JavaScript off, where it+ never runs — neither caption has an answer yet. Show the one that is true of a+ page nothing is driving. */+.captionScrub {+ display: none;+}++:global([data-os-scrub="on"]) .captionScrub {+ display: inline;+}+.figure {margin: 0;min-width: 0;diff --git a/website/src/components/Walkthrough/useBandPlayback.ts b/website/src/components/Walkthrough/useBandPlayback.tsindex e57c60a84..af902c03c 100644--- a/website/src/components/Walkthrough/useBandPlayback.ts+++ b/website/src/components/Walkthrough/useBandPlayback.ts@@ -26,11 +26,18 @@ const VISIBLE = 0.55;export type BandPlayback = {/** The band that currently owns the single <video>, if any. */activeId: string | null;+ /** Bumped by every play() call. Ownership alone cannot express "start again",+ * because the band asking is usually the band that already owns the element. */+ playToken: number;/** Bands that have played to the end, and now show their result frame. */playedIds: ReadonlySet<string>;/** Whether clips start on their own when scrolled to. */autoplay: boolean;setAutoplay: (on: boolean) => void;+ /** Turns autoplay off, cancels the dwell timers already counting down, and+ * gives up the element — so the control stops what is running, not only what+ * would have run next. */+ stopAutoplay: () => void;/** True once the browser has taken over — controls stay inert before that. */hydrated: boolean;/** True where motion is unwelcome: reduced motion, or a metered connection. */@@ -48,6 +55,7 @@ export type BandPlayback = {export function useBandPlayback(): BandPlayback {const hydrated = useIsBrowser();const [activeId, setActiveId] = useState<string | null>(null);+ const [playToken, setPlayToken] = useState(0);const [playedIds, setPlayedIds] = useState<ReadonlySet<string>>(new Set());const [refusedIds, setRefusedIds] = useState<ReadonlySet<string>>(new Set());const [autoplay, setAutoplay] = useState(true);@@ -56,9 +64,13 @@ export function useBandPlayback(): BandPlayback {const nodes = useRef(new Map<string, HTMLElement>());const timers = useRef(new Map<string, ReturnType<typeof setTimeout>>());- // Read inside the observer callback, which is created once.- const state = useRef({ autoplay, quiet });- state.current = { autoplay, quiet };+ // Set the moment the reader works the toggle. The environment supplies the+ // default; after that the choice is theirs and nothing may recompute it.+ const chosen = useRef(false);+ // Read inside the observer callback, and inside stopAutoplay — both of which+ // are created once and must not see a stale render's values.+ const state = useRef({ autoplay, activeId, refusedIds });+ state.current = { autoplay, activeId, refusedIds };useEffect(() => {if (!hydrated) return;@@ -77,19 +89,28 @@ export function useBandPlayback(): BandPlayback {).connection;const thin = conn?.saveData === true || /^(slow-)?2g$/.test(conn?.effectiveType ?? "");- const sync = () => {+ // Two queries, two callbacks. Width decides which rendition to load and+ // nothing else; reading it in the same callback as the motion default is+ // what let a phone rotation, or a zoom past 200%, put autoplay back on+ // after the reader had turned it off.+ const syncMotion = () => {const q = motion.matches || thin;setQuiet(q);- setAutoplay(!q);- setSmall(narrow.matches);+ // An explicit choice outranks the default, but asking the OS for+ // stillness outranks the choice: it withdraws consent rather than+ // merely suggesting one. The toggle is still there to opt back in.+ if (q) chosen.current = false;+ if (!chosen.current) setAutoplay(!q);};- sync();+ const syncNarrow = () => setSmall(narrow.matches);+ syncMotion();+ syncNarrow();- motion.addEventListener("change", sync);- narrow.addEventListener("change", sync);+ motion.addEventListener("change", syncMotion);+ narrow.addEventListener("change", syncNarrow);return () => {- motion.removeEventListener("change", sync);- narrow.removeEventListener("change", sync);+ motion.removeEventListener("change", syncMotion);+ narrow.removeEventListener("change", syncNarrow);};}, [hydrated]);@@ -114,7 +135,14 @@ export function useBandPlayback(): BandPlayback {clearTimer(id);continue;}- if (!state.current.autoplay || state.current.quiet) continue;+ // `quiet` is not consulted here. It has already set the default+ // this gate reads, and consulting it twice made the toggle+ // unable to do anything at all for a reduced-motion reader.+ if (!state.current.autoplay) continue;+ // A band whose play() the browser actually refused has lost its+ // control; handing it the element again would leave the page+ // playing a clip with nothing beside it to stop.+ if (state.current.refusedIds.has(id)) continue;if (timers.current.has(id)) continue;timers.current.set(id,@@ -153,7 +181,14 @@ export function useBandPlayback(): BandPlayback {return cb;}, []);- const play = useCallback((id: string) => setActiveId(id), []);+ // Ownership is a claim on the element, not an instruction to start. Asking the+ // band that already holds it to play writes its own id back over itself, React+ // bails out of the render, and nothing downstream ever hears about it — which+ // is why the token exists and why every caller must go through here.+ const play = useCallback((id: string) => {+ setActiveId(id);+ setPlayToken((n) => n + 1);+ }, []);const markPlayed = useCallback((id: string) => {setPlayedIds((prev) => {@@ -174,11 +209,33 @@ export function useBandPlayback(): BandPlayback {});}, []);+ const chooseAutoplay = useCallback((on: boolean) => {+ chosen.current = true;+ setAutoplay(on);+ }, []);++ const stopAutoplay = useCallback(() => {+ chosen.current = true;+ setAutoplay(false);+ // Clearing the timers is the half that matters: a dwell scheduled a moment+ // before the click would otherwise mount a clip after the control already+ // reads off.+ for (const t of timers.current.values()) clearTimeout(t);+ timers.current.clear();+ // Marking it played first — the band it stops is a band the reader has seen+ // motion from, and releasing the element must not snap the picture back to+ // the opening frame.+ if (state.current.activeId) markPlayed(state.current.activeId);+ setActiveId(null);+ }, [markPlayed]);+return {activeId,+ playToken,playedIds,autoplay,- setAutoplay,+ setAutoplay: chooseAutoplay,+ stopAutoplay,hydrated,quiet,small,diff --git a/website/src/components/Walkthrough/useScrub.ts b/website/src/components/Walkthrough/useScrub.tsnew file mode 100644index 000000000..81125831f--- /dev/null+++ b/website/src/components/Walkthrough/useScrub.ts@@ -0,0 +1,143 @@+import { useEffect, useRef, useState } from "react";++/**+ * Scroll drives the picture.+ *+ * A band that has a scrub rendition gets taller than the viewport and pins its+ * figure, so scrolling through the band walks the clip frame by frame: the zoom+ * lands, the reply types itself, the render bar fills, all at the reader's own+ * pace and in either direction. Apple's product pages do the same thing per+ * section rather than as one pinned stage held across the page, which is also+ * what makes it degrade cleanly — take away two CSS rules and the band is an+ * ordinary picture beside an ordinary paragraph.+ *+ * Three things this does NOT do, each learned the expensive way:+ *+ * It does not scrub with `requestVideoFrameCallback`. That callback stops firing+ * whenever the element is not being composited, which is precisely the state you+ * would be trying to observe.+ *+ * It does not wait on `seeked` to pace itself. `seeked` fires at a p50 of 0.0 ms+ * — before any frame has been presented — so pacing on it means racing ahead of+ * the picture. The in-flight guard here is a plain boolean cleared by the same+ * event, used only to avoid queueing seeks, never to decide what is on screen.+ *+ * It does not touch the DOM on `scroll`. Every read happens once per animation+ * frame, and only while the band is on screen; a scroll listener that measures+ * layout is how a page that looks fine on a desktop turns to treacle on a phone.+ */++const ATTR = "data-os-scrub";++/** Set before first paint by the inline script in the section's <Head>, so the+ * tall pinned layout is never a post-hydration reflow. */+export function useScrubEnabled(): boolean {+ const [on, setOn] = useState(false);+ useEffect(() => {+ // Narrow viewports are excluded on purpose, not by omission. A seek per+ // animation frame is the most expensive thing on the page, phones are where+ // it costs most and where the battery pays for it, and a pinned band on a+ // short screen leaves the copy nowhere to go. Below 901px the band is an+ // ordinary picture beside an ordinary paragraph, which is a fine thing to be.+ const motion = window.matchMedia("(prefers-reduced-motion: reduce)");+ const wide = window.matchMedia("(min-width: 901px)");+ const sync = () => {+ const ok = !motion.matches && wide.matches && CSS.supports("position", "sticky");+ document.documentElement.setAttribute(ATTR, ok ? "on" : "off");+ setOn(ok);+ };+ sync();+ motion.addEventListener("change", sync);+ wide.addEventListener("change", sync);+ return () => {+ motion.removeEventListener("change", sync);+ wide.removeEventListener("change", sync);+ };+ }, []);+ return on;+}++type Options = {+ /** The element whose scroll range maps to the clip. */+ band: React.RefObject<HTMLElement | null>;+ video: React.RefObject<HTMLVideoElement | null>;+ seconds: number;+ enabled: boolean;+};++export function useScrub({ band, video, seconds, enabled }: Options): {+ /** 0-1, for the progress rail. Updated on the same frame as the picture. */+ progress: number;+ /** True once enough of the clip has arrived to seek anywhere in it. */+ ready: boolean;+ /** True while the band's scroll range is on screen — the clip only mounts then. */+ near: boolean;+} {+ const [progress, setProgress] = useState(0);+ const [ready, setReady] = useState(false);+ const [near, setNear] = useState(false);+ const seeking = useRef(false);+ const shown = useRef(-1);++ useEffect(() => {+ const el = band.current;+ if (!enabled || !el || typeof IntersectionObserver === "undefined") return;+ // A viewport of margin on each side: the clip has to be decodable by the+ // time its first frame is asked for, and a 268 KB file on a slow link is+ // not instant. Nothing is fetched for a band the reader never reaches.+ const io = new IntersectionObserver((entries) => setNear(entries[0].isIntersecting), {+ rootMargin: "100% 0px",+ });+ io.observe(el);+ return () => io.disconnect();+ }, [band, enabled]);++ useEffect(() => {+ if (!enabled || !near) return;+ const el = band.current;+ if (!el) return;++ let frame = 0;+ const tick = () => {+ frame = requestAnimationFrame(tick);+ const rect = el.getBoundingClientRect();+ const travel = rect.height - window.innerHeight;+ if (travel <= 0) return;+ const p = Math.min(1, Math.max(0, -rect.top / travel));+ setProgress(p);++ const v = video.current;+ if (!v || !v.duration || seeking.current) return;+ // Quantised to the clip's own frames: without this every rAF asks for a+ // new sub-frame time, the decoder never finishes one seek before the+ // next arrives, and the picture lags the scroll by a growing margin.+ const target = Math.min(seconds - 0.001, p * seconds);+ const step = Math.round((target * v.duration) / seconds / (1 / 20));+ if (step === shown.current) return;+ shown.current = step;+ seeking.current = true;+ v.currentTime = target;+ };+ frame = requestAnimationFrame(tick);+ return () => cancelAnimationFrame(frame);+ }, [band, video, seconds, enabled, near]);++ useEffect(() => {+ const v = video.current;+ if (!v || !near) return;+ const done = () => {+ seeking.current = false;+ };+ const loaded = () => setReady(true);+ v.addEventListener("seeked", done);+ v.addEventListener("error", done);+ v.addEventListener("loadeddata", loaded);+ return () => {+ v.removeEventListener("seeked", done);+ v.removeEventListener("error", done);+ v.removeEventListener("loadeddata", loaded);+ };+ }, [video, near]);++ return { progress, ready, near };+}diff --git a/website/src/css/custom.css b/website/src/css/custom.cssindex 26d0e33b4..29c060471 100644--- a/website/src/css/custom.css+++ b/website/src/css/custom.css@@ -57,11 +57,11 @@--os-fg: #3a3f47;--os-muted: #6b7280;--os-meta: #98a0aa;- /* Darkened from #0d9668. The design system's light accent measures 3.63:1 on- --os-bg, and it is used for inline 12.5px text (`xattr`, `sudo` in the- install panes) and as the fill behind white on both Download buttons —- both Level AA failures at that ratio. #0a7d57 measures 4.96:1 on the page- and 5.14:1 under white, at the same hue. */+ /* Darkened from #0d9668. The design system's light accent measures 3.63:1+ against --os-bg, which is a Level AA failure twice over: as inline 12.5px+ text (`xattr`, `sudo` in the install panes), and — it being the same pair+ of colours either way round — as the fill under the --os-bg label of both+ Download buttons. #0a7d57 measures 4.96:1, at the same hue. */--os-accent: #0a7d57;--os-brand-lo: #086b4a;--os-accent-soft: rgba(10, 125, 87, 0.11);@@ -313,7 +313,7 @@ body {padding: 7px 14px !important;border-radius: 9px;background: var(--os-accent);- color: #fff !important;+ color: var(--os-bg) !important;font-size: 12.5px;font-weight: 600;}diff --git a/website/src/pages/index.module.css b/website/src/pages/index.module.cssindex 700e4e5a2..e97f6835a 100644--- a/website/src/pages/index.module.css+++ b/website/src/pages/index.module.css@@ -32,6 +32,15 @@margin-bottom: 22px;}+/* --os-accent clears 4.5:1 against --os-bg, but the pill is not --os-bg: its own+ --os-accent-soft tint composites to rgb(224,237,234) and takes the label down+ to 4.28:1 at 12.8px/600, the one place on the page where accent text sits on+ an accent-tinted surface. Light only — --os-brand-lo measures 4.45:1 on the+ dark pill, so unscoped this would trade the failure rather than fix it. */+:global([data-theme="light"]) .badge {+ color: var(--os-brand-lo);+}+.title {margin: 20px 0 0;font-size: clamp(42px, 6vw, 68px);diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsxindex 46e6516ce..c1e556233 100644--- a/website/src/pages/index.tsx+++ b/website/src/pages/index.tsx@@ -76,8 +76,10 @@ export default function Home() {</span><h3>Nothing is uploaded</h3><p>- Recording, transcription and rendering all happen on your machine. The chat panel is- the only part that talks to a network, and only with a key you supply.+ Recording, transcription and rendering all happen on your machine, and your video+ never leaves it. Text leaves only when you ask: the chat panel and caption+ translation, each with a key you supply. Transcription downloads its 264 MB Whisper+ model once, on first run.</p></article>diff --git a/website/static/img/walkthrough/editor-1040.avif b/website/static/img/walkthrough/editor-1040.avifnew file mode 100644index 000000000..13b3e6f24Binary files /dev/null and b/website/static/img/walkthrough/editor-1040.avif differdiff --git a/website/static/img/walkthrough/editor-1560.avif b/website/static/img/walkthrough/editor-1560.avifnew file mode 100644index 000000000..bd46257d9Binary files /dev/null and b/website/static/img/walkthrough/editor-1560.avif differdiff --git a/website/static/video/04-agent-scrub.mp4 b/website/static/video/04-agent-scrub.mp4new file mode 100644index 000000000..b677ff41fBinary files /dev/null and b/website/static/video/04-agent-scrub.mp4 differdiff --git a/website/static/video/04-agent-sm-scrub.mp4 b/website/static/video/04-agent-sm-scrub.mp4new file mode 100644index 000000000..d8b6d5280Binary files /dev/null and b/website/static/video/04-agent-sm-scrub.mp4 differdiff --git a/website/static/video/05-export-scrub.mp4 b/website/static/video/05-export-scrub.mp4new file mode 100644index 000000000..67f5a29d8Binary files /dev/null and b/website/static/video/05-export-scrub.mp4 differdiff --git a/website/static/video/05-export-sm-scrub.mp4 b/website/static/video/05-export-sm-scrub.mp4new file mode 100644index 000000000..b4c8d67e0Binary files /dev/null and b/website/static/video/05-export-sm-scrub.mp4 differ