Skip to content

Add auto-video scripts on macOS (and fix packaged MP4 export) - #1367

Draft
jaiminbhut wants to merge 3 commits into
webadderallorg:mainfrom
jaiminbhut:feat/auto-video
Draft

jaiminbhut wants to merge 3 commits into
webadderallorg:mainfrom
jaiminbhut:feat/auto-video

Conversation

@jaiminbhut

@jaiminbhut jaiminbhut commented Nov 28, 2026 •

Copy link
Copy Markdown

Pull Request Template

Description

Recordly can now run an auto-video script: a JSON file of steps (open an app or URL, move, click, type, press keys, scroll, wait, zoom) that Recordly performs while it records, then exports the MP4 automatically, with no save dialog. Start one from Recordly → Run Auto-Video Script…. ⌘⇧Esc stops a run. macOS only.

{
  "version": 1,
  "output": "demo.mp4",
  "steps": [
    { "type": "open", "app": "TextEdit" },
    { "type": "wait", "ms": 2000 },
    { "type": "key", "combo": "cmd+n" },
    { "type": "zoom" },
    { "type": "type", "text": "Hello from Recordly!" },
    { "type": "wait", "ms": 1000 }
  ]
}

How it works:

  • src/lib/autoVideo/script.ts: script format and validator. Every problem is reported with its location (for example steps[2].x must be a number) before anything runs. Keys are checked against the input helper's key table, and a test keeps the two in sync.
  • electron/native/AutoVideoInputDriver.swift: a small helper that posts mouse and keyboard input with CGEvent (needs Accessibility). If it's stopped mid-click or mid-keypress, it releases the held button or key before exiting.
  • electron/autoVideo/: the runner (steps, timing, start/stop recording, abort), the helper client, the controller (menu item, file picker, stop shortcut, dialogs) and the export hand-off queue.
  • useAutoVideoExport: when the recording opens in the editor, the editor claims the waiting export (retrying a failed claim), lets automatic zooms settle, exports to the script's output path, and reports the result.

Writing scripts with Claude

There's a companion Claude skill, so people can describe a demo in plain words and get a working script: jaiminbhut/automate-recordly-claude.

  • Claude Code: /plugin marketplace add jaiminbhut/automate-recordly-claude, then /plugin install recordly@automate-recordly-claude.
  • Claude desktop / claude.ai: upload auto-video-script.zip from the latest release under Settings → Capabilities → Skills.
  • The skill teaches Claude the script format and its pitfalls: waits after open, coordinates in screen points, and preferring keyboard steps over guessed click positions. It then checks every script with a bundled copy of src/lib/autoVideo/script.ts, so it accepts exactly what Recordly accepts. On the user's Mac it also reads the display bounds, and warns about clicks off-screen.
  • Claude only writes the script; the user runs it in Recordly. Nothing in this PR lets an AI drive input directly.

The PR has three commits, so each fix can be reviewed or reverted on its own:

  1. Build guard fix. The main-CJS ESM guard flagged the object key export: exportVideo, as ESM syntax, which failed npm run dev.
  2. CSP fix for packaged MP4 export (please review). The renderer CSP added in b17ae00 (script-src 'self' 'wasm-unsafe-eval') breaks every MP4 export in packaged builds, manual ones included. Exports fail at read-source-metadata with "Evaluating a string as JavaScript violates the following Content Security Policy directive…". The cause is web-demuxer: its Emscripten bindings build functions with new Function, inside a blob worker that inherits the page's CSP. This commit adds 'unsafe-eval' to unblock exports and leaves the rest of the policy unchanged. A stricter follow-up would load the demuxer worker from a file (a worker loaded from a file doesn't inherit the page's CSP) or build web-demuxer with DYNAMIC_EXECUTION=0, then drop 'unsafe-eval' again.
  3. The auto-video feature. It also ignores .claude/settings.local.json.

Motivation

Making a polished product demo means recording the same clicks and typing over and over until one take is clean. A script makes the take repeatable: edit the steps, run it again, and get the same video with automatic zooms and an exported MP4. It also lets people describe a demo to Claude, which writes the script for them with the Recordly skill.

The CSP fix is needed regardless of auto-video: without it, packaged builds of main can't export MP4s.

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

None.

Screenshots / Video

Video to be attached: a recording made end to end by an auto-video script.

Testing Guide

Automated:

  • npm run typecheck, npm run lint and npm test pass (5,030 tests).
  • New tests: script validation, runner, helper client, export queue, export-claim retries, and a helper lifecycle test that compiles the Swift helper and checks it exits cleanly on SIGTERM.

Manual (macOS):

  1. Run npm run dev. The app that launches it needs Screen Recording and Accessibility permission.
  2. Save the JSON above as demo.json.
  3. In Recordly's recording controls, select a display.
  4. Choose Recordly → Run Auto-Video Script… and pick demo.json. Don't touch the mouse or keyboard while it runs.
  5. Recordly records, opens the editor, and saves demo.mp4 next to the script.
  6. Press ⌘⇧Esc during a run to check that it stops cleanly.

Verified on an M3 Pro (macOS 27.2):

  • Signed packaged build: a script ran, recorded and exported the MP4 automatically.
  • Packaged headless export with the CSP fix: 630 frames exported to a valid 21 s H.264 MP4. Before the fix, the export failed at read-source-metadata.
  • Stuck input: I killed the helper while it held F20. Without the fix the key stayed down. With the fix it was released.

Known follow-up: starting a script while the previous recording is still saving waits 60 s before failing with a generic error. Failing fast needs a renderer → main reply channel.

Checklist

  • I have read and agree to the contribution terms for my contributions in this pull request.
  • I have performed a self-review of my code.
  • I have added any necessary screenshots or videos.
  • I have linked related issue(s) and updated the changelog if applicable.

Thank you for contributing!

The guard that checks dist-electron/main.cjs for leftover ESM syntax
matched any line starting with "export", so an object key such as
`export: exportVideo,` failed the build. Skip `export:` keys.
web-demuxer's Emscripten bindings build functions with `new Function`
inside a blob worker, which inherits the page's CSP. Without
'unsafe-eval', every MP4 export in a packaged build fails while reading
the source video. Drop it again once the demuxer worker loads from a
file or is built with DYNAMIC_EXECUTION=0.
Recordly can run a JSON script that opens apps or URLs, moves and
clicks the mouse, types, presses keys, scrolls, waits and marks zooms
while it records, then exports the MP4 without a save dialog. Start a
script from Recordly > Run Auto-Video Script...; Cmd+Shift+Esc stops it.

- src/lib/autoVideo/script.ts: script format and validator. Keys are
  checked against the input helper's key table, so an unpressable key
  fails before recording starts.
- electron/native/AutoVideoInputDriver.swift: posts the input with
  CGEvent (needs Accessibility). It releases any held button or key
  when stopped mid-press.
- electron/autoVideo: runner, helper client, controller and the export
  hand-off queue.
- useAutoVideoExport: the editor claims the waiting export (with
  retries), lets automatic zooms settle, exports to the script's output
  path and reports back.

macOS only. Also ignore .claude/settings.local.json.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

1 participant