Repository navigation
Add auto-video scripts on macOS (and fix packaged MP4 export) - #1367
Draft
jaiminbhut wants to merge 3 commits into
Draft
jaiminbhut wants to merge 3 commits into
jaiminbhut wants to merge 3 commits into
Conversation
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.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 examplesteps[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'soutputpath, 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.
/plugin marketplace add jaiminbhut/automate-recordly-claude, then/plugin install recordly@automate-recordly-claude.auto-video-script.zipfrom the latest release under Settings → Capabilities → Skills.open, coordinates in screen points, and preferring keyboard steps over guessed click positions. It then checks every script with a bundled copy ofsrc/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.The PR has three commits, so each fix can be reviewed or reverted on its own:
export: exportVideo,as ESM syntax, which failednpm run dev.script-src 'self' 'wasm-unsafe-eval') breaks every MP4 export in packaged builds, manual ones included. Exports fail atread-source-metadatawith "Evaluating a string as JavaScript violates the following Content Security Policy directive…". The cause is web-demuxer: its Emscripten bindings build functions withnew 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 withDYNAMIC_EXECUTION=0, then drop'unsafe-eval'again..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
maincan't export MP4s.Type of Change
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 lintandnpm testpass (5,030 tests).Manual (macOS):
npm run dev. The app that launches it needs Screen Recording and Accessibility permission.demo.json.demo.json. Don't touch the mouse or keyboard while it runs.demo.mp4next to the script.Verified on an M3 Pro (macOS 27.2):
read-source-metadata.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
Thank you for contributing!