🎥 Make videos programmatically with React
better docs
Jonny Burger6ae6ba154149
diff --git a/packages/cli/src/browser-download-bar.ts b/packages/cli/src/browser-download-bar.tsindex 7c62b9d8a6..ad1c670293 100644--- a/packages/cli/src/browser-download-bar.ts+++ b/packages/cli/src/browser-download-bar.ts@@ -3,7 +3,7 @@ import {RenderInternals} from '@remotion/renderer';import {chalk} from './chalk';import {Log} from './log';import {makeProgressBar} from './make-progress-bar';-import {createOverwriteableCliOutput} from './progress-bar';+import {LABEL_WIDTH, createOverwriteableCliOutput} from './progress-bar';import {shouldUseNonOverlayingLogger} from './should-use-non-overlaying-logger';import {truthy} from './truthy';@@ -19,9 +19,8 @@ const makeDownloadProgress = ({const progress = bytesDownloaded / totalBytes;return [- ` +`,+ `${doneIn ? 'Got' : 'Getting'} Headless Shell`.padEnd(LABEL_WIDTH, ' '),makeProgressBar(progress, false),- `${doneIn ? 'Got' : 'Getting'} Headless Shell`,doneIn === null? (progress * 100).toFixed(0) + '%': chalk.gray(`${doneIn}ms`),@@ -42,7 +41,9 @@ export const defaultBrowserDownloadProgress = ({return () => {Log.info({indent, logLevel},- 'Downloading Chrome Headless Shell https://www.remotion.dev/chrome-headless-shell',+ chalk.gray(+ 'Downloading Chrome Headless Shell https://www.remotion.dev/chrome-headless-shell',+ ),);const updatesDontOverwrite = shouldUseNonOverlayingLogger({logLevel});diff --git a/packages/docs/docs/miscellaneous/chrome-headless-shell.mdx b/packages/docs/docs/miscellaneous/chrome-headless-shell.mdxindex e7213f1a45..77edca3903 100644--- a/packages/docs/docs/miscellaneous/chrome-headless-shell.mdx+++ b/packages/docs/docs/miscellaneous/chrome-headless-shell.mdx@@ -5,26 +5,29 @@ title: Chrome Headless Shellcrumb: "FAQ"----# Chrome Headless Shell<AvailableFrom v="4.0.137"/>+# Chrome Headless Shell<AvailableFrom v="4.0.208"/>-Remotion will download [Chrome Headless Shell](https://developer.chrome.com/blog/chrome-headless-shell) if no local browser can be found and an API for rendering videos is used.+From v4.0.208, Remotion will download [Chrome Headless Shell](https://developer.chrome.com/blog/chrome-headless-shell) before the first render.+This will future-proof your Remotion project, because headless mode will be removed in a future version of Chrome.## Supported platformsThe following platforms are supported:-- Linux (x64)-- Windows (x64)- macOS (x64 and arm64)+- Windows (x64)+- Linux (x64 and arm64) - [install the Linux dependencies](/docs/miscellaneous/linux-dependencies)-:::note-[Remotion Lambda](/docs/lambda) is also support despite being arm64 on Linux.-:::-## Ensure a local browser is found+## Ensure Headless Shell is available++There are two ways to ensure Chrome Headless Shell is available:-Use [`ensureBrowser()`](/docs/renderer/ensure-browser) or [`npx remotion browser ensure`](/docs/cli/browser/ensure) to ensure a local browser is found.-This function will download Chrome Headless Shell if no local browser is found.+- [`npx remotion browser ensure`](/docs/cli/browser/ensure) on the command line+- [`ensureBrowser()`](/docs/renderer/ensure-browser) as a Node.js / Bun API++It is recommended use call these functions if you do server-side rendering.+That way, if a request comes in wanting to render a video, the browser is already downloaded and ready to go.## Bring your own binary@@ -47,12 +50,17 @@ Chrome Headless Shell will download tonode_modules/.remotion/chrome-headless-shell/[platform]/chrome-headless-shell-[platform]```-`platform` can be one of `mac-arm64`, `mac-x64`, `linux64` or `win64`.+`platform` can be one of `mac-arm64`, `mac-x64`, `linux64`, `linux-arm64` or `win64`.At this path, a folder with the necessary files will be created.An executable `./chrome-headless-shell` (`.\chrome-headless-shell.exe` on Windows) will be created.-## Chrome vs. Chrome Headless Shell+## Why this change?++Remotion previously used the desktop version of Chrome that many users had already installed.+This workflow is bound to break at some point, which is why Remotion is not picking up the desktop version of Chrome anymore.++## What is Chrome Headless Shell?Chrome used to ship with a `--headless` flag, which Remotion would use.@@ -66,16 +74,14 @@ The old headless mode is being extracted into "Chrome Headless Shell".Hence we encourage you to use Chrome Headless Shell to future-proof your Remotion application.-## Chrome vs. Chromium--Chromium is the open-source project that Chrome is based on. Some versions of Chromium don't the necessary codecs for the [`<Video >`](/docs/video) tag as well as for functions in [`@remotion/media-utils`](/docs/media-utils).+## Version-This is why we recommend Chrome over Chromium.+Remotion will download a well-tested Chrome version from the `123.0.6312` release line.+Upgrades may happen in a patch release and will be listed here.-## Changes in Remotion v5.0+## On Lambda and Cloud Run-Remotion 5.0 will not recognize your regular Chrome browser anymore.-You will need to use Chrome Headless Shell, because Chrome is [discontinuing the `--headless=old`](#chrome-vs-chrome-headless-shell) mode.+If you are using [Remotion Lambda](/docs/lambda) or [Cloud Run](/docs/cloudrun), you don't need to worry about installing a browser - it is included in the runtime already.## Thorium (v4.0.18 - v4.0.135)diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.tsindex 6175d43438..2baa734796 100644--- a/packages/lambda/src/test/integration/webhooks.test.ts+++ b/packages/lambda/src/test/integration/webhooks.test.ts@@ -1,4 +1,4 @@-import {RenderInternals} from '@remotion/renderer';+import {RenderInternals, ensureBrowser} from '@remotion/renderer';import {ServerlessRoutines} from '@remotion/serverless/client';import path from 'path';import {VERSION} from 'remotion/version';@@ -29,7 +29,8 @@ beforeEach(() => {};});-beforeAll(() => {+beforeAll(async () => {+ await ensureBrowser();return async () => {await RenderInternals.killAllBrowsers();};