🎥 Make videos programmatically with React
Publish Canvas Capture extension separately
Jonny Burger421962cabdca
diff --git a/.agents/skills/install-canvas-capture-browser/scripts/install-browser.sh b/.agents/skills/install-canvas-capture-browser/scripts/install-browser.shindex e4c5ba8487..cdd4340f07 100755--- a/.agents/skills/install-canvas-capture-browser/scripts/install-browser.sh+++ b/.agents/skills/install-canvas-capture-browser/scripts/install-browser.sh@@ -6,7 +6,7 @@ expected_version="150.0.7842.0"expected_revision="r1631007"expected_sha256="86de7ffdb70d3f41714bf5b2b6fe3ef23cbf6c924eb407343418f31b9c721f7f"download_url="https://storage.googleapis.com/chrome-for-testing-per-commit-public/mac-arm64/r1631007/chrome-mac-arm64.zip"-install_app="/Users/jonathanburger/Applications/Recorder Chrome.app"+install_app="${HOME:?}/Applications/Recorder Chrome.app"usage() {printf '%s\n' 'Usage: install-browser.sh [--install-app PATH]'diff --git a/packages/canvas-capture-extension/README.public.md b/packages/canvas-capture-extension/README.public.mdnew file mode 100644index 0000000000..1220a3dd7c--- /dev/null+++ b/packages/canvas-capture-extension/README.public.md@@ -0,0 +1,19 @@+# Remotion Canvas Capture++Remotion Canvas Capture records an area—or a whole webpage—as a+high-resolution H.264 MP4 or VP9 WebM using Chromium's experimental+HTML-in-canvas implementation.++## Install++Follow the [Canvas Capture installation guide](https://www.remotion.dev/docs/canvas-capture/installation).++## Development++This repository contains the built Chrome extension and is generated from the+[`packages/canvas-capture-extension`](https://github.com/remotion-dev/remotion/tree/main/packages/canvas-capture-extension)+package in the Remotion monorepo. Changes made directly in this repository will+be overwritten by the release pipeline.++Please report issues and contribute changes in the+[`remotion-dev/remotion`](https://github.com/remotion-dev/remotion) repository.diff --git a/packages/docs/docs/canvas-capture/installation.mdx b/packages/docs/docs/canvas-capture/installation.mdxindex 6c403f2a48..c5511cecd0 100644--- a/packages/docs/docs/canvas-capture/installation.mdx+++ b/packages/docs/docs/canvas-capture/installation.mdx@@ -8,42 +8,31 @@ sidebar_label: Installation> Tip: Copy the URL of this page into an agent to let it install it for you.-Canvas Capture currently requires an Apple Silicon Mac, [Bun](https://bun.com/) and a checkout of the Remotion repository.+Canvas Capture currently requires an Apple Silicon Mac.-## Install the dependencies+## Download the extension-From the root of the Remotion repository, install the dependencies:+Clone the built extension to a durable location:```bash title="Terminal"-bun install+git clone --depth=1 https://github.com/remotion-dev/canvas-capture.git \+ "$HOME/Applications/Remotion Canvas Capture Extension"```+The repository contains a production build of Canvas Capture. You do not need to clone or build Remotion.+## Install Chrome for TestingCanvas Capture uses Chrome for Testing `150.0.7842.0` at revision `r1631007`. This is the exact version known to support the required HTML-in-canvas API.-Install the browser using the bundled script:+Install the browser using the script included with Canvas Capture:```bash title="Terminal"-.agents/skills/install-canvas-capture-browser/scripts/install-browser.sh \- --install-app "$HOME/Applications/Recorder Chrome.app"+"$HOME/Applications/Remotion Canvas Capture Extension/install-browser.sh"```This browser does not receive security updates. Only use it with websites you trust.-## Build the extension--Build Canvas Capture and copy it to a directory outside the repository:--```bash title="Terminal"-.agents/skills/canvas-capture-extension/scripts/rebuild-extension.sh \- --repo "$PWD" \- --install-dir "$HOME/Applications/Remotion Canvas Capture Extension" \- --browser-executable "$HOME/Applications/Recorder Chrome.app/Contents/MacOS/Google Chrome for Testing"-```--Keeping the extension outside the repository prevents it from breaking when the checkout or worktree is deleted.-## Launch the browserLaunch the pinned browser with the HTML-in-canvas API enabled:diff --git a/packages/it-tests/src/templates/publish.ts b/packages/it-tests/src/templates/publish.tsindex 6a21ad2720..b5acd8a47c 100644--- a/packages/it-tests/src/templates/publish.ts+++ b/packages/it-tests/src/templates/publish.ts@@ -1,4 +1,11 @@-import {cpSync, readFileSync, writeFileSync} from 'node:fs';+import {+ chmodSync,+ copyFileSync,+ cpSync,+ readFileSync,+ readdirSync,+ writeFileSync,+} from 'node:fs';import {tmpdir} from 'node:os';import path from 'path';import {$} from 'bun';@@ -216,6 +223,76 @@ const publishAgentPlugins = async () => {]);};+const publishCanvasCapture = async () => {+ const monorepoDir = path.join(__dirname, '..', '..', '..', '..');+ const packageDir = path.join(+ monorepoDir,+ 'packages',+ 'canvas-capture-extension',+ );+ const workingDir = path.join(tmpdir(), `canvas-capture-${Math.random()}`);++ await $`bun run make`.cwd(packageDir);+ await $`git clone [email protected]:remotion-dev/canvas-capture.git ${workingDir} --depth 1`;++ const defaultBranch = await $`git branch --show-current`+ .cwd(workingDir)+ .text();+ const existingFilesInRepo = await $`git ls-files`.cwd(workingDir).quiet();+ for (const file of existingFilesInRepo.stdout+ .toString('utf-8')+ .trim()+ .split('\n')) {+ if (file === '') continue;+ await $`rm ${file}`.cwd(workingDir).quiet();+ }++ const distDir = path.join(packageDir, 'dist');+ for (const entry of readdirSync(distDir)) {+ cpSync(path.join(distDir, entry), path.join(workingDir, entry), {+ recursive: true,+ });+ }+ copyFileSync(+ path.join(packageDir, 'README.public.md'),+ path.join(workingDir, 'README.md'),+ );+ const installBrowserPath = path.join(workingDir, 'install-browser.sh');+ copyFileSync(+ path.join(+ monorepoDir,+ '.agents',+ 'skills',+ 'install-canvas-capture-browser',+ 'scripts',+ 'install-browser.sh',+ ),+ installBrowserPath,+ );+ chmodSync(installBrowserPath, 0o755);+ copyFileSync(+ path.join(monorepoDir, 'LICENSE.md'),+ path.join(workingDir, 'LICENSE.md'),+ );++ await $`git add .`.cwd(workingDir).nothrow();+ const hasChanges = await $`git status --porcelain`.cwd(workingDir).text();+ if (!hasChanges) {+ console.log('No changes in Canvas Capture');+ return;+ }++ const packageJson = JSON.parse(+ readFileSync(path.join(packageDir, 'package.json'), 'utf-8'),+ );+ await $`git commit -m "Update Canvas Capture"`.cwd(workingDir);+ const versionTag = `v${packageJson.version}`;+ await $`git tag ${versionTag}`.cwd(workingDir);+ await $`git push --atomic origin ${defaultBranch.trim()} ${versionTag}`.cwd(+ workingDir,+ );+};+const publishClaudeCodePlugin = async () => {const claudeCodePluginDir = path.join(__dirname,@@ -345,6 +422,7 @@ for (let i = 0; i < templates.length; i += CONCURRENCY) {results.push(...(await Promise.allSettled([publishAgentPlugins(),+ publishCanvasCapture(),publishClaudeCodePlugin(),publishKimiCodePlugin(),])),