TraceAvatar
Menu

Docs

GIF and video

trace-avatar-render, and Save as video in the browser.

trace-avatar-render

Plays a trace on your real app in headless Chromium and writes a GIF or an MP4. Long waits are cut, a stalled guide fails the render (so a docs GIF that no longer matches the app fails CI), and masked fields only ever get dots.

terminal
npx trace-avatar-render invoice.trace.json --url http://localhost:3000/app --out invoice.gif
Option
--urlthe page the guide starts on (required)
--out.gif or .mp4, repeatable (required)
--mode perform --allow-performDo it for me: it really clicks and types, so use a sandbox account
--storage-statea signed-in Playwright session
--frame browserthe app in a browser window on a background
--camerazoom in on each click and typing step; pair with --scale 2
--captions burn|vtt|bothburned-in captions, or VTT captions and chapters
--poster, --title-card, --end-carda PNG, and cards before and after
--blur, --hideblur or hide selectors before capture
--voiceMP4 narration of each caption
--allow-stallrender a stalled guide instead of failing

From code

 
import { render } from 'trace-avatar-render';

const r = await render({
  trace: './invoice.trace.json',
  url: 'http://localhost:3000/app',
  out: ['invoice.gif', { file: 'invoice.mp4', fps: 30 }],
  storageState: './auth.json',
  frame: 'browser', camera: true, captions: 'both', poster: true, titleCard: true,
});
r.durationMs; r.outputs;

render rejects with a RenderError (with .screenshot) when the guide stalls, errors, or can’t start.

Save as video, in the browser

No server needed: trace-avatar/export records the guide playing on the page itself. The browser asks to share the tab, the guide plays from step 1, and you get a GIF or a video (WebM, or MP4 in Safari).

 
import { saveVideo } from 'trace-avatar/export';

const v = await saveVideo(controller, {
  format: 'gif',                              // or 'video'
  area: document.querySelector('#app'),       // what to keep; default the whole viewport
  onProgress: (p) => console.log(p.phase),    // 'asking' | 'recording' | 'encoding'
});
v.download();
  • It rejects with an ExportError whose reason is unsupported, denied, cancelled, stalled or failed.
  • The GIF encoder loads only for a GIF and runs in a worker; a strict Content-Security-Policy needs worker-src blob:.
  • A guide that changes pages with a full page load can’t be saved this way; use trace-avatar-render for those.

The full reference is in the README on GitHub.