Skip to content

🎥 Make videos programmatically with React

pass options through nicely

Jonny Burger64d2ea55030a
diff --git a/packages/cloudrun/src/api/deploy-site.ts b/packages/cloudrun/src/api/deploy-site.ts
index 3201757b0f..bddb8316ab 100644
--- a/packages/cloudrun/src/api/deploy-site.ts
+++ b/packages/cloudrun/src/api/deploy-site.ts
@@ -28,6 +28,9 @@ type Options = {
rootDir?: string;
bypassBucketNameValidation?: boolean;
gitSource?: GitSource | null;
+ keyboardShortcutsEnabled?: boolean;
+ askAIEnabled?: boolean;
+ experimentalClientSideRenderingEnabled?: boolean;
};
type OptionalParameters = {
@@ -102,11 +105,11 @@ export const internalDeploySiteRaw = async ({
onSymlinkDetected: () => undefined,
outDir: null,
audioLatencyHint: null,
- experimentalClientSideRenderingEnabled: false,
+ experimentalClientSideRenderingEnabled:
+ options?.experimentalClientSideRenderingEnabled ?? false,
renderDefaults: null,
- // todo: deal with it later
- askAIEnabled: true,
- keyboardShortcutsEnabled: true,
+ askAIEnabled: options?.askAIEnabled ?? true,
+ keyboardShortcutsEnabled: options?.keyboardShortcutsEnabled ?? true,
}),
]);
diff --git a/packages/cloudrun/src/cli/commands/sites/create.ts b/packages/cloudrun/src/cli/commands/sites/create.ts
index 88c8831168..67fada51c4 100644
--- a/packages/cloudrun/src/cli/commands/sites/create.ts
+++ b/packages/cloudrun/src/cli/commands/sites/create.ts
@@ -24,6 +24,12 @@ import {
import {quit} from '../../helpers/quit';
import {Log} from '../../log';
+const {
+ disableGitSourceOption,
+ askAIOption,
+ experimentalClientSideRenderingOption,
+} = BrowserSafeApis.options;
+
export const SITES_CREATE_SUBCOMMAND = 'create';
export const sitesCreateSubcommand = async (
@@ -138,10 +144,9 @@ export const sitesCreateSubcommand = async (
const bundleStart = Date.now();
let uploadStart = Date.now();
- const disableGitSource =
- BrowserSafeApis.options.disableGitSourceOption.getValue({
- commandLine: CliInternals.parsedCli,
- }).value;
+ const disableGitSource = disableGitSourceOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
const gitSource = CliInternals.getGitSource({
remotionRoot,
@@ -149,6 +154,16 @@ export const sitesCreateSubcommand = async (
logLevel,
});
+ const askAIEnabled = askAIOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const experimentalClientSideRenderingEnabled =
+ experimentalClientSideRenderingOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const keyboardShortcutsEnabled =
+ ConfigInternals.getKeyboardShortcutsEnabled();
+
const {serveUrl, siteName, stats} = await internalDeploySiteRaw({
entryPoint: file,
siteName: desiredSiteName,
@@ -179,6 +194,9 @@ export const sitesCreateSubcommand = async (
ignoreRegisterRootWarning: true,
publicDir: null,
rootDir: remotionRoot,
+ askAIEnabled,
+ experimentalClientSideRenderingEnabled,
+ keyboardShortcutsEnabled,
},
indent: false,
privacy: parsedCloudrunCli.privacy ?? 'public',
diff --git a/packages/docs/docs/cloudrun/deploysite.mdx b/packages/docs/docs/cloudrun/deploysite.mdx
index dac4804e4a..09908d5286 100644
--- a/packages/docs/docs/cloudrun/deploysite.mdx
+++ b/packages/docs/docs/cloudrun/deploysite.mdx
@@ -54,21 +54,17 @@ The bucket to where the website will be deployed. The bucket must have been crea
### `siteName?`
-_optional_
-
Specify the subfolder in your Cloud Storage bucket that you want the site to deploy to. If you omit this property, a new subfolder with a random name will be created. If a site already exists with the name you passed, it will be overwritten. Can only contain the following characters: `0-9`, `a-z`, `A-Z`, `-`, `!`, `_`, `.`, `*`, `'`, `(`, `)`
### `options?`
-_optional_
-
An object with the following properties:
-#### `onBundleProgress`
+#### `onBundleProgress?`
Callback from Webpack when the bundling has progressed. Passes a number between 0 and 100 to the callback, see example at the top of the page.
-#### `onUploadProgress`
+#### `onUploadProgress?`
Callback function that gets called when uploading of the assets has progressed. Passes an object with the following properties to the callback:
@@ -77,19 +73,19 @@ Callback function that gets called when uploading of the assets has progressed.
- `totalSize` (_number_): Total size in bytes of all the files in the bundle.
- `sizeUploaded` (_number_): Amount of bytes uploaded so far.
-#### `webpackOverride`
+#### `webpackOverride?`
Allows to pass a custom webpack override. See [`bundle()` -> webpackOverride](/docs/bundle#webpackoverride) for more information.
-#### `enableCaching`
+#### `enableCaching?`
Whether webpack caching should be enabled. See [`bundle()` -> enableCaching](/docs/bundle#enablecaching) for more information.
-#### `publicDir`
+#### `publicDir?`
Set the directory in which the files that can be loaded using [`staticFile()`](/docs/staticfile) are located. By default it is the folder `public/` located in the [Remotion Root](/docs/terminology/remotion-root) folder. If you pass a relative path, it will be resolved against the [Remotion Root](/docs/terminology/remotion-root).
-#### `rootDir`
+#### `rootDir?`
The directory in which the Remotion project is rooted in. This should be set to the directory that contains the `package.json` which installs Remotion. By default, it is the current working directory.
@@ -97,17 +93,35 @@ The directory in which the Remotion project is rooted in. This should be set to
The current working directory is the directory from which your program gets executed from. It is not the same as the file where bundle() gets called.
:::
-#### `ignoreRegisterRootWarning`
+#### `ignoreRegisterRootWarning?`
Ignore an error that gets thrown if you pass an entry point file which does not contain `registerRoot`.
+#### `keyboardShortcutsEnabled?`<AvailableFrom v="4.0.407"/>
+
+_default: `true`_
+
+Whether keyboard shortcuts should be enabled in the Studio. See [Config.setKeyboardShortcutsEnabled()](/docs/config#setkeyboardshortcutsenabled) for more information.
+
+#### `askAIEnabled?`<AvailableFrom v="4.0.407"/>
+
+_default: `true`_
+
+Whether the Ask AI option should be enabled in the Studio. See [Config.setAskAIEnabled()](/docs/config#setaskaienabled) for more information.
+
+#### `experimentalClientSideRenderingEnabled?`<AvailableFrom v="4.0.407"/>
+
+_default: `false`_
+
+Whether experimental client-side rendering should be enabled in the Studio. See [Config.setExperimentalClientSideRenderingEnabled()](/docs/config#setexperimentalclientsiderenderingenabled) for more information.
+
## Return value
An object with the following values:
### `serveUrl`
-string\_
+_string_
An URL such as `https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh/index.html`.
diff --git a/packages/docs/docs/lambda/deploysite.mdx b/packages/docs/docs/lambda/deploysite.mdx
index 6fb6037447..efae1ff357 100644
--- a/packages/docs/docs/lambda/deploysite.mdx
+++ b/packages/docs/docs/lambda/deploysite.mdx
@@ -53,27 +53,21 @@ The AWS region in which the bucket resides.
### `siteName?`
-_optional_
-
Specify the subfolder in your S3 bucket that you want the site to deploy to. If you omit this property, a new subfolder with a random name will be created. If a site already exists with the name you passed, it will be overwritten. Can only contain the following characters: `0-9`, `a-z`, `A-Z`, `-`, `!`, `_`, `.`, `*`, `'`, `(`, `)`
### `logLevel?`<AvailableFrom v="4.0.140"/>
-_optional_
-
<Options id="log" />
### `options?`
-_optional_
-
An object with the following properties:
-#### `onBundleProgress`
+#### `onBundleProgress?`
Callback from Webpack when the bundling has progressed. Passes a number between 0 and 100 to the callback, see example at the top of the page.
-#### `onUploadProgress`
+#### `onUploadProgress?`
Callback function that gets called when uploading of the assets has progressed. Passes an object with the following properties to the callback:
@@ -82,21 +76,21 @@ Callback function that gets called when uploading of the assets has progressed.
- `totalSize` (_number_): Total size in bytes of all the files in the bundle.
- `sizeUploaded` (_number_): Amount of bytes uploaded so far.
-#### `webpackOverride`
+#### `webpackOverride?`
Allows to pass a custom webpack override. See [`bundle()` -> webpackOverride](/docs/bundle#webpackoverride) for more information.
-#### `enableCaching`
+#### `enableCaching?`
Whether webpack caching should be enabled. Default true. See [`bundle()` -> enableCaching](/docs/bundle#enablecaching) for more information.
-#### `publicDir`
+#### `publicDir?`
_available from v3.2.17_
Set the directory in which the files that can be loaded using [`staticFile()`](/docs/staticfile) are located. By default it is the folder `public/` located in the [Remotion Root](/docs/terminology/remotion-root) folder. If you pass a relative path, it will be resolved against the [Remotion Root](/docs/terminology/remotion-root).
-#### `rootDir`
+#### `rootDir?`
_available from v3.2.17_
@@ -106,13 +100,31 @@ The directory in which the Remotion project is rooted in. This should be set to
The current working directory is the directory from which your program gets executed from. It is not the same as the file where bundle() gets called.
:::
-#### `ignoreRegisterRootWarning`
+#### `ignoreRegisterRootWarning?`
_available from v3.3.55_
Ignore an error that gets thrown if you pass an entry point file which does not contain `registerRoot`.
-### `privacy`
+#### `keyboardShortcutsEnabled?`<AvailableFrom v="4.0.407"/>
+
+_default: `true`_
+
+Whether keyboard shortcuts should be enabled in the Studio. See [Config.setKeyboardShortcutsEnabled()](/docs/config#setkeyboardshortcutsenabled) for more information.
+
+#### `askAIEnabled?`<AvailableFrom v="4.0.407"/>
+
+_default: `true`_
+
+Whether the Ask AI option should be enabled in the Studio. See [Config.setAskAIEnabled()](/docs/config#setaskaienabled) for more information.
+
+#### `experimentalClientSideRenderingEnabled?`<AvailableFrom v="4.0.407"/>
+
+_default: `false`_
+
+Whether experimental client-side rendering should be enabled in the Studio. See [Config.setExperimentalClientSideRenderingEnabled()](/docs/config#setexperimentalclientsiderenderingenabled) for more information.
+
+### `privacy?`
_available from v3.3.97_
@@ -133,7 +145,6 @@ An object with the following values:
- `serveUrl` _(string)_: An URL such as `https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/abcdef/index.html`.
You can use this "Serve URL" to render a video on Remotion Lambda using:
-
- The [`npx remotion lambda render`](/docs/lambda/cli/render) and [`npx remotion lambda still`](/docs/lambda/cli/still) commands
- The [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) and [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda) functions.
- Locally using the [`renderMedia()`](/docs/renderer/render-media) and [`renderStill()`](/docs/renderer/render-still) functions.
diff --git a/packages/lambda/src/api/deploy-site.ts b/packages/lambda/src/api/deploy-site.ts
index 838a28972c..a157fafb80 100644
--- a/packages/lambda/src/api/deploy-site.ts
+++ b/packages/lambda/src/api/deploy-site.ts
@@ -37,6 +37,9 @@ type OptionalParameters = {
publicDir?: string | null;
rootDir?: string;
bypassBucketNameValidation?: boolean;
+ keyboardShortcutsEnabled?: boolean;
+ askAIEnabled?: boolean;
+ experimentalClientSideRenderingEnabled?: boolean;
};
privacy: 'public' | 'no-acl';
gitSource: GitSource | null;
@@ -128,6 +131,12 @@ const mandatoryDeploySite = async ({
onPublicDirCopyProgress: () => undefined,
onSymlinkDetected: () => undefined,
outDir: null,
+ askAIEnabled: options?.askAIEnabled ?? true,
+ audioLatencyHint: null,
+ experimentalClientSideRenderingEnabled:
+ options?.experimentalClientSideRenderingEnabled ?? false,
+ keyboardShortcutsEnabled: options?.keyboardShortcutsEnabled ?? true,
+ renderDefaults: null,
}),
]);
diff --git a/packages/lambda/src/cli/commands/sites/create.ts b/packages/lambda/src/cli/commands/sites/create.ts
index 22e820eb67..3784b9407a 100644
--- a/packages/lambda/src/cli/commands/sites/create.ts
+++ b/packages/lambda/src/cli/commands/sites/create.ts
@@ -35,6 +35,8 @@ const {
publicDirOption,
throwIfSiteExistsOption,
disableGitSourceOption,
+ askAIOption,
+ experimentalClientSideRenderingOption,
} = BrowserSafeApis.options;
export const sitesCreateSubcommand = async (
@@ -167,6 +169,16 @@ export const sitesCreateSubcommand = async (
logLevel,
});
+ const askAIEnabled = askAIOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const experimentalClientSideRenderingEnabled =
+ experimentalClientSideRenderingOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+ const keyboardShortcutsEnabled =
+ ConfigInternals.getKeyboardShortcutsEnabled();
+
const {serveUrl, siteName, stats} = await LambdaInternals.internalDeploySite({
entryPoint: file,
siteName: desiredSiteName ?? implementation.randomHash(),
@@ -209,6 +221,9 @@ export const sitesCreateSubcommand = async (
enableCaching: ConfigInternals.getWebpackCaching(),
webpackOverride: ConfigInternals.getWebpackOverrideFn() ?? ((f) => f),
bypassBucketNameValidation: Boolean(parsedLambdaCli['force-bucket-name']),
+ askAIEnabled,
+ experimentalClientSideRenderingEnabled,
+ keyboardShortcutsEnabled,
},
region: getAwsRegion(),
privacy:
diff --git a/packages/serverless/src/provider-implementation.ts b/packages/serverless/src/provider-implementation.ts
index a35eb7a341..48c986c4b3 100644
--- a/packages/serverless/src/provider-implementation.ts
+++ b/packages/serverless/src/provider-implementation.ts
@@ -1,4 +1,4 @@
-import type {bundle} from '@remotion/bundler';
+import type {BundlerInternals} from '@remotion/bundler';
import type {
ChromiumOptions,
EmittedArtifact,
@@ -134,7 +134,7 @@ export type InsideFunctionSpecifics<Provider extends CloudProvider> = {
export type FullClientSpecifics<Provider extends CloudProvider> = {
id: '__remotion_full_client_specifics';
- bundleSite: typeof bundle;
+ bundleSite: typeof BundlerInternals.internalBundle;
readDirectory: ReadDir;
uploadDir: UploadDir<Provider>;
createFunction: CreateFunction<Provider>;