# Research notes This spec describes an async video messaging app modelled on the design of Loom, the screen-and-camera recording product. Everything here is described in our own words from public pages and from watching how public share links behave. No source code, text, images, icons or branding were copied, and the built app must not use any of them (see "Names and words" in `spec.md`). No Loom account was created or signed in to. ## How it was studied With REA (Reverse Engineer Anything: `rea-agents` 6.9.0 from npm, the official package of github.com/morluto/rea) on 2026-11-16. `rea capture-browser-scenario` was run against two public share pages in headless Chrome (1440 × 900, UTC, light, reduced motion). It captured accessibility text and a screenshot after each step, and recorded the network without bodies. - **Steps:** wait for the player, let it settle, start playback with the keyboard, let it play, scroll, and reach the bottom. - **Evidence ids:** - `ev_142d4f7926dd8af85de2db75b2272fd3c7dd9b73974a02a8601614fc3b31ffa7` (full run, playing) - `ev_15c08f2deafc0dfc80d8eb0579232b6cd41b7bba862ccc2816d9ad7b66df7327` (a first run whose mouse click on the player timed out) What the runs showed: - **Page layout:** the video's title, the owner's name, how long ago it was recorded, a view count, and Copy link and Download actions above the player. A sidebar of activity and comments sits beside it, with an empty state inviting the first comment. - **Before the first play:** a big central play button with the length. - **Speeds:** a speed menu from 0.8× to 2.5× that shows the remaining time at each speed, with a default above 1×. - **Keyboard:** shortcuts for play/pause, seeking back and forward, mute, speed, full screen and more. - **Chapters:** a list of chapters that link to `?t=` start times, also drawn as segments on the seek bar. - **Reactions:** a row of six emoji reactions and a Comment button under the player. Comments and reactions are pinned to the time they were made. The public product pages (the screen recorder page, read 2026-11-16) describe the recorder: - screen only, camera only, or both, with the camera shown as a movable, resizable bubble - microphone choice - a three-second countdown before recording starts - stop, then an instant link to share - trimming in the browser - comments and emoji from viewers - captions, embeds, drawing tools and desktop and mobile apps Evidence files (kept by the spec author, not shipped): the Evidence JSON, plus per-step accessibility text and screenshots. ## Where this spec chooses differently - **Browser only.** The original records through desktop apps and a browser extension, which can capture any window and show the bubble on the real desktop. This spec records in a web page with `getDisplayMedia` and draws the bubble into the video on a canvas, so the bubble is placed on a preview in the page, not on the desktop. - **Upload after review.** The original streams the video while recording, so the link is ready the moment you stop. This spec records into memory, shows a review step (trim, one removed section, title, mute) and uploads only on Save, in 5 MB R2 multipart parts (three at a time, retried, with a progress bar), which keeps the Worker stateless. With the 10-minute cap and the bitrates in R4, a recording is at most about 190 MB. - **Cuts made in the browser.** 0.1.1 kept the whole file and had the player skip and silence parts, so downloads were the full recording and a muted video still carried its sound. 0.1.2 makes real cuts: on Save the browser decodes the kept frames and encodes a new H.264 MP4 with WebCodecs (through Mediabunny, MPL-2.0), and uploads only that, so cut parts and muted sound never reach the server. A Worker can't encode video, and server-side transcoding would need another service. Where WebCodecs encoders are missing, the kept part is replayed into `MediaRecorder` in real time. Re-cutting a saved video downloads it, cuts it in the browser and swaps the file; it can't be undone. Only one removed section is offered because every extra cut is another visible jump. - **Not recording the recorder.** A web page has to be open to start and stop a recording, so a whole-screen recording begins and ends on it. 0.1.0 had no answer. 0.1.1 hides the recorder tab from the picker, switches to a shared tab or window right away (`CaptureController`), offers floating controls (Document Picture-in-Picture) and Alt+Shift+S, and above all lets the owner trim the start and end before saving. Cutting automatically when the page is visible was considered and rejected: it guesses, and a guess that cuts the wrong second is worse than a handle the owner drags. - **Chapters typed by hand.** No automatic chapters, titles or summaries, because they need speech-to-text and a language model. - **No transcript or captions.** In-browser speech recognition isn't available in headless test browsers, and a hosted speech-to-text service would add cost and an account. Neither can be checked cheaply, so both are out of scope (see `spec.md`). - **Accounts.** Email and password with a server-side allowlist (`ALLOWED_EMAILS`), instead of sign-in with Google or by email. No email is sent, so the app needs no email service. Share links are public to anyone who has them, with no workspace or privacy levels. - **Six fixed reactions** and no "more" picker. The speed list is 0.75× to 2.5× with 1× as the default. - **Runs on Cloudflare:** one Worker with static assets, D1 and R2. Passwords use Web Crypto PBKDF2 (100000 iterations, the Workers maximum). ## Mobile playback (0.1.1) David's first recordings on the live site wouldn't play on his phone. What was found: - **The files:** 0.1.0 preferred WebM, so Chrome on his computer recorded VP9 video and Opus audio in WebM. Safari on iPhone can't play WebM with Opus at all before iOS 17.4, and its WebM support since then is strict. - **The structure:** `fix-webm-duration` writes the duration by rewriting the Segment and the first Cluster with known sizes, and both sizes run to the end of the file. That makes every later Cluster a child of the first, which the Matroska rules don't allow. Chrome, Firefox, ffmpeg and GStreamer (Playwright's Linux WebKit) shrug it off; this is the most likely reason Safari stops or refuses. A copy of his recording (read-only, never modified on the server) had exactly this layout: sizes at bytes 40 and 219. - **Not the cause:** byte ranges. `curl` against the live media URL gave `206` with `Content-Range`, `Content-Length` and `Accept-Ranges: bytes` for `bytes=0-1` and `bytes=0-`, and `200` for a plain request, as Safari needs. - **The fix:** record MP4 with H.264 first (every current phone and computer plays it, and `MediaRecorder` MP4 carries its duration); for WebM, keep `fix-webm-duration` but set both sizes back to "unknown" with same-length patches, at record time and, for files already stored, in the Worker's response (the R2 object stays as it was); if a browser still can't play the format, say so and offer the download. - **What could not be proved here:** the real iOS media stack. Emulated phones (Chromium with iPhone and Pixel profiles, and Playwright WebKit with the iPhone 13 profile) played the old file even before the repair, so the repair can't be shown to fix Safari from this box; it is the change the format rules call for, and new recordings sidestep the question by being MP4. ## Third-party pieces - `fix-webm-duration` 1.0.6 (MIT): writes the length into Chromium's WebM recordings, which otherwise have no duration and can't be seeked. - Inter (SIL Open Font License 1.1) through `@fontsource-variable/inter`. - Everything else (icons, illustrations, the sign-in hero's mock player) is drawn in code for this spec. ## Checked by building it A build made from these files ran under `wrangler dev` with a local D1 and R2 and no Cloudflare account. Camera, microphone and screen were Chromium's fake devices. - 11 unit tests passed. - 24 Playwright tests passed: 20 on desktop, plus the 2 phone tests under both the `iphone-13` and `pixel-7` projects. - The tests recorded real WebM files from screen + camera, screen only and camera only, uploaded them in multipart parts, and played them back on the share page with seeking. The same build was deployed to Cloudflare as a Worker with a custom domain, D1 and R2. Live end-to-end tests passed there, as did the phone layouts at iPhone 13 and Pixel 7 sizes: - an address outside the allowlist was refused at sign-up and sign-in - record, upload, share, comment, react, trim and delete all worked - a signed-out visitor could watch the link The temporary test account was then removed and the allowlist set back to its owner. The source of that build is at https://github.com/dwrtz/video (MIT). **0.1.1** was checked the same way: - 18 unit tests passed. - 33 Playwright tests passed: 27 on desktop (including the six review and recorder-capture tests and the two format tests), the 2 phone tests under both `iphone-13` and `pixel-7`, and the WebKit test under `webkit-iphone`. Chromium now records MP4 (`video/mp4`, H.264), and WebKit plays and seeks it. - On the live deploy, with a temporary test account: sign-up refusal, record → review (trim, removed section, title, mute) → save → share → playback, discard, the phone flow under iPhone 13 and Pixel 7 emulation, and WebKit (iPhone 13) playback of a new MP4 and of the owner's existing 0.1.0 WebM from the repaired stream (views blocked so it wasn't counted). `curl` against the owner's video: `HEAD` 200 with `Accept-Ranges`, `bytes=0-1` 206 with `Content-Length: 2`, `bytes=0-` 206, a range past the end 416, and the served head differing from the stored file in exactly the eight size bytes. The live D1 got `0002_edits.sql` (columns added, existing values unchanged), the test account and its data were removed, and the allowlist was set back to the owner. **0.1.2** (real cuts) was checked the same way: - 22 unit tests passed, including the remapping of times, chapters and removed spans. - 38 Playwright tests passed across `desktop`, `iphone-13`, `pixel-7` and `webkit-iphone`. Every cut was checked on the stored file with `ffprobe` and a timecode drawn into the fake screen: a 6 s recording trimmed to 1–5.5 s with 2–3 s removed and muted came back 3.5 s long, MP4, with no audio track and exactly one 1 s jump in the timecode; a later cut in Edit video moved chapters, comments and reactions as specified and left the old R2 object deleted; the real-time fallback cut correctly after a cancel. - On the live deploy, with a temporary test account: the same review cut (WebCodecs in headless Chromium, 150–170 ms for 4 s kept), a viewer download identical to the cut, a later cut whose old object was gone from R2 (only the new `v-…` file and the thumbnail remained), phones under iPhone 13 and Pixel 7 emulation saving a trimmed MP4, and WebKit (iPhone 13) playback. The live D1 got `0003_real_cuts.sql` in two steps around the deploy (columns added, Worker deployed, old columns dropped); the owner's video had no edits, so its file and values were unchanged. The test account and its data were removed, and the allowlist was set back to the owner. - Speed: WebCodecs cut a 61 s recording to 43 s in 2.6 s in headless Chromium, so a one-minute clip takes a few seconds plus the upload. The screenshots are from that build at 2× scale (the review and Edit video screenshots from 0.1.2). The "screen" in them is short clips of public spekkr.com pages, and the camera is an illustrated presenter drawn in SVG. Both were fed in through the browser's fake capture devices, so every frame came out of the app's own recorder.