Skip to content

🎥 Make videos programmatically with React

Update in all the places

Pramod9822cae9adaa
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index 39c6250ab1..133f89cc7d 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -541,6 +541,7 @@ export const benchmarkCommand = async (
}).value,
onLog: RenderInternals.defaultOnLog,
licenseKey: null,
+ isProduction: null,
},
(run, progress) => {
benchmarkProgress.update(
diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.ts
index 2da3ac8c2b..499d2722e7 100644
--- a/packages/cli/src/render-flows/render.ts
+++ b/packages/cli/src/render-flows/render.ts
@@ -710,6 +710,7 @@ export const renderVideoFlow = async ({
onLog,
apiKey: null,
licenseKey: null,
+ isProduction: null,
});
if (!updatesDontOverwrite) {
updateRenderProgress({newline: true, printToConsole: true});
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index eff574a063..ff4844f894 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -414,6 +414,7 @@ export const renderStillFlow = async ({
},
apiKey: null,
licenseKey: null,
+ isProduction: null,
});
aggregate.rendering = {
diff --git a/packages/cloudrun/src/functions/render-media-single-thread.ts b/packages/cloudrun/src/functions/render-media-single-thread.ts
index 708016f78a..1a8374c2d7 100644
--- a/packages/cloudrun/src/functions/render-media-single-thread.ts
+++ b/packages/cloudrun/src/functions/render-media-single-thread.ts
@@ -210,6 +210,7 @@ export const renderMediaSingleThread = async (
onLog: RenderInternals.defaultOnLog,
apiKey: null,
licenseKey: null,
+ isProduction: null,
});
const storage = new Storage();
diff --git a/packages/cloudrun/src/functions/render-still-single-thread.ts b/packages/cloudrun/src/functions/render-still-single-thread.ts
index 7de9f5a96d..cc560caab1 100644
--- a/packages/cloudrun/src/functions/render-still-single-thread.ts
+++ b/packages/cloudrun/src/functions/render-still-single-thread.ts
@@ -113,6 +113,7 @@ export const renderStillSingleThread = async (
onLog: RenderInternals.defaultOnLog,
apiKey: null,
licenseKey: null,
+ isProduction: null,
});
Log.info({indent: false, logLevel: body.logLevel}, 'Still rendered');
diff --git a/packages/lambda-client/src/make-lambda-payload.ts b/packages/lambda-client/src/make-lambda-payload.ts
index a009c25000..3ae1a8cbd2 100644
--- a/packages/lambda-client/src/make-lambda-payload.ts
+++ b/packages/lambda-client/src/make-lambda-payload.ts
@@ -88,7 +88,7 @@ export type InnerRenderMediaOnLambdaInput = {
metadata: Record<string, string> | null;
storageClass: StorageClass | null;
requestHandler: RequestHandler | null;
- isProduction?: boolean;
+ isProduction: boolean | null;
} & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
export const makeLambdaRenderMediaPayload = async ({
@@ -225,7 +225,7 @@ export const makeLambdaRenderMediaPayload = async ({
offthreadVideoThreads: offthreadVideoThreads ?? null,
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
storageClass: storageClass ?? null,
- isProduction,
+ isProduction: isProduction ?? null,
};
};
@@ -332,6 +332,6 @@ export const makeLambdaRenderStillPayload = async ({
offthreadVideoThreads: offthreadVideoThreads ?? null,
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
storageClass: storageClass ?? null,
- isProduction,
+ isProduction: isProduction ?? null,
};
};
diff --git a/packages/lambda-client/src/render-media-on-lambda.ts b/packages/lambda-client/src/render-media-on-lambda.ts
index 423265c0e7..806b7c68dc 100644
--- a/packages/lambda-client/src/render-media-on-lambda.ts
+++ b/packages/lambda-client/src/render-media-on-lambda.ts
@@ -202,7 +202,7 @@ export const renderMediaOnLambdaOptionalToRequired = (
storageClass: options.storageClass ?? null,
requestHandler: options.requestHandler ?? null,
mediaCacheSizeInBytes: options.mediaCacheSizeInBytes ?? null,
- isProduction: options.isProduction,
+ isProduction: options.isProduction ?? null,
};
};
diff --git a/packages/lambda-client/src/test/concurrency-payload.test.ts b/packages/lambda-client/src/test/concurrency-payload.test.ts
index 8c859731df..5cf483b25d 100644
--- a/packages/lambda-client/src/test/concurrency-payload.test.ts
+++ b/packages/lambda-client/src/test/concurrency-payload.test.ts
@@ -56,6 +56,7 @@ test('Should include concurrency field in payload', async () => {
storageClass: null,
requestHandler: null,
preferLossless: false,
+ isProduction: null,
});
expect(payload.type).toBe(ServerlessRoutines.start);
@@ -116,6 +117,7 @@ test('Should handle null concurrency', async () => {
storageClass: null,
requestHandler: null,
preferLossless: false,
+ isProduction: null,
});
expect(payload.type).toBe(ServerlessRoutines.start);
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 1e8129e8d8..1bae4ec247 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -358,6 +358,9 @@ export const renderCommand = async ({
parsedLambdaCli[BrowserSafeApis.options.licenseKeyOption.cliFlag] ?? null,
storageClass: parsedLambdaCli['storage-class'] ?? null,
requestHandler: null,
+ isProduction:
+ parsedLambdaCli[BrowserSafeApis.options.isProductionKeyOption.cliFlag] ??
+ null,
});
const progressBar = CliInternals.createOverwriteableCliOutput({
diff --git a/packages/lambda/src/test/integration/renders/old-version.test.ts b/packages/lambda/src/test/integration/renders/old-version.test.ts
index 4d1b75987e..8d7faf2868 100644
--- a/packages/lambda/src/test/integration/renders/old-version.test.ts
+++ b/packages/lambda/src/test/integration/renders/old-version.test.ts
@@ -63,6 +63,7 @@ test(
licenseKey: null,
storageClass: null,
mediaCacheSizeInBytes: null,
+ isProduction: null,
},
functionName: 'remotion-dev-render',
region: 'us-east-1',
diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.ts
index 4e7a1ac26d..04f17ba856 100644
--- a/packages/lambda/src/test/integration/webhooks.test.ts
+++ b/packages/lambda/src/test/integration/webhooks.test.ts
@@ -98,6 +98,7 @@ test(
licenseKey: null,
storageClass: null,
mediaCacheSizeInBytes: null,
+ isProduction: null,
},
functionName: 'remotion-dev-lambda',
region: 'us-east-1',
@@ -219,6 +220,7 @@ test(
metadata: null,
licenseKey: null,
storageClass: null,
+ isProduction: null,
},
timeoutInTest: 1000,
requestHandler: null,
diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsx
index 7b1c24d303..cac3babab1 100644
--- a/packages/renderer/src/options/index.tsx
+++ b/packages/renderer/src/options/index.tsx
@@ -22,6 +22,7 @@ import {glOption} from './gl';
import {hardwareAccelerationOption} from './hardware-acceleration';
import {headlessOption} from './headless';
import {imageSequencePatternOption} from './image-sequence-pattern';
+import {isProductionKeyOption} from './is-production-key';
import {jpegQualityOption} from './jpeg-quality';
import {audioLatencyHintOption} from './latency-hint';
import {licenseKeyOption} from './license-key';
@@ -99,6 +100,7 @@ export const allOptions = {
mediaCacheSizeInBytesOption,
darkModeOption,
publicLicenseKeyOption,
+ isProductionKeyOption,
};
export type AvailableOptions = keyof typeof allOptions;
diff --git a/packages/renderer/src/options/is-production-key.tsx b/packages/renderer/src/options/is-production-key.tsx
new file mode 100644
index 0000000000..79ea666556
--- /dev/null
+++ b/packages/renderer/src/options/is-production-key.tsx
@@ -0,0 +1,42 @@
+import type {AnyRemotionOption} from './option';
+
+const cliFlag = 'is-production-key' as const;
+
+let currentIsProductionKey: boolean | null = null;
+
+export const isProductionKeyOption = {
+ name: 'Is Production Key',
+ cliFlag,
+ description: () => (
+ <>
+ Pass "true" if you are rendering in production. All the production renders
+ are considered as billable renders on the Pro platform.
+ </>
+ ),
+ ssrName: 'isProductionKey' as const,
+ docLink: 'https://www.remotion.dev/docs/licensing',
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as string | null,
+ };
+ }
+
+ if (currentIsProductionKey !== null) {
+ return {
+ source: 'config',
+ value: currentIsProductionKey.toString(),
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (value: string | null) => {
+ currentIsProductionKey = value === 'true';
+ },
+ type: null as string | null,
+} satisfies AnyRemotionOption<string | null>;
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index e892a3a163..90f3f48024 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -151,7 +151,7 @@ export type InternalRenderMediaOptions = {
onArtifact: OnArtifact | null;
metadata: Record<string, string> | null;
onLog: OnLog;
- isProduction?: boolean;
+ isProduction: boolean | null;
} & EitherApiKeyOrLicenseKey &
MoreRenderMediaOptions;
@@ -1091,6 +1091,6 @@ export const renderMedia = ({
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
licenseKey: licenseKey ?? apiKey ?? null,
onLog: defaultOnLog,
- isProduction,
+ isProduction: isProduction ?? null,
});
};
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index 8247aa8983..ada6f4d6a4 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -76,7 +76,7 @@ type InternalRenderStillOptions = {
port: number | null;
onArtifact: OnArtifact | null;
onLog: OnLog;
- isProduction?: boolean;
+ isProduction: boolean | null;
} & ToOptions<typeof optionsMap.renderStill>;
export type RenderStillOptions = {
@@ -578,6 +578,6 @@ export const renderStill = (
apiKey: apiKey ?? null,
licenseKey: licenseKey ?? null,
onLog: defaultOnLog,
- isProduction,
+ isProduction: isProduction ?? null,
});
};
diff --git a/packages/serverless-client/src/constants.ts b/packages/serverless-client/src/constants.ts
index 2a2d599559..98e8328c61 100644
--- a/packages/serverless-client/src/constants.ts
+++ b/packages/serverless-client/src/constants.ts
@@ -161,7 +161,7 @@ export type ServerlessStartPayload<Provider extends CloudProvider> = {
apiKey: string | null;
licenseKey: string | null;
storageClass: Provider['storageClass'] | null;
- isProduction?: boolean;
+ isProduction: boolean | null;
};
export type ServerlessPayloads<Provider extends CloudProvider> = {
@@ -221,6 +221,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
metadata: Record<string, string> | null;
licenseKey: string | null;
storageClass: Provider['storageClass'] | null;
+ isProduction: boolean | null;
};
status: ServerlessStatusPayload<Provider>;
renderer: {
@@ -273,6 +274,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
progressEveryNthFrame: number;
forcePathStyle: boolean;
metadata: Record<string, string> | null;
+ isProduction: boolean | null;
};
still: {
type: ServerlessRoutines.still;
@@ -305,7 +307,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
apiKey: string | null;
licenseKey: string | null;
storageClass: Provider['storageClass'] | null;
- isProduction?: boolean;
+ isProduction: boolean | null;
};
compositions: {
type: ServerlessRoutines.compositions;
diff --git a/packages/serverless/src/handlers/launch.ts b/packages/serverless/src/handlers/launch.ts
index a54e82a3d4..72dd8d7c2b 100644
--- a/packages/serverless/src/handlers/launch.ts
+++ b/packages/serverless/src/handlers/launch.ts
@@ -311,6 +311,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({
metadata: params.metadata,
offthreadVideoThreads: params.offthreadVideoThreads,
mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,
+ isProduction: params.isProduction,
};
return payload;
});
@@ -724,7 +725,12 @@ export const launchHandler = async <Provider extends CloudProvider>({
});
clearTimeout(webhookDueToTimeout);
- sendTelemetryEvent(params.licenseKey ?? null, params.logLevel);
+ sendTelemetryEvent(
+ params.licenseKey ?? null,
+ params.logLevel,
+ null,
+ params.isProduction,
+ );
if (!params.webhook || webhookInvoked) {
return;
diff --git a/packages/serverless/src/handlers/renderer.ts b/packages/serverless/src/handlers/renderer.ts
index 1110b12643..b39a9f5929 100644
--- a/packages/serverless/src/handlers/renderer.ts
+++ b/packages/serverless/src/handlers/renderer.ts
@@ -355,6 +355,7 @@ const renderHandler = async <Provider extends CloudProvider>({
mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,
onLog: RenderInternals.defaultOnLog,
licenseKey: null,
+ isProduction: null,
})
.then(({slowestFrames}) => {
RenderInternals.Log.verbose(
diff --git a/packages/serverless/src/handlers/send-telemetry-event.ts b/packages/serverless/src/handlers/send-telemetry-event.ts
index 236f648085..b06156a47a 100644
--- a/packages/serverless/src/handlers/send-telemetry-event.ts
+++ b/packages/serverless/src/handlers/send-telemetry-event.ts
@@ -5,8 +5,8 @@ import {RenderInternals} from '@remotion/renderer';
export const sendTelemetryEvent = async (
licenseKey: string | null,
logLevel: LogLevel,
- isStill?: boolean,
- isProduction?: boolean,
+ isStill: boolean | null,
+ isProduction: boolean | null,
) => {
if (licenseKey === null) {
return Promise.resolve();
diff --git a/packages/serverless/src/handlers/start.ts b/packages/serverless/src/handlers/start.ts
index 880d9d81f9..2713dd24ba 100644
--- a/packages/serverless/src/handlers/start.ts
+++ b/packages/serverless/src/handlers/start.ts
@@ -129,6 +129,7 @@ export const startHandler = async <Provider extends CloudProvider>({
offthreadVideoThreads: params.offthreadVideoThreads,
storageClass: params.storageClass,
mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,
+ isProduction: params.isProduction,
};
await providerSpecifics.callFunctionAsync({
diff --git a/packages/serverless/src/handlers/still.ts b/packages/serverless/src/handlers/still.ts
index 5f3eb0e0ce..14f5fb356a 100644
--- a/packages/serverless/src/handlers/still.ts
+++ b/packages/serverless/src/handlers/still.ts
@@ -336,6 +336,7 @@ const innerStillHandler = async <Provider extends CloudProvider>(
onLog: RenderInternals.defaultOnLog,
apiKey: null,
licenseKey: null,
+ isProduction: null,
});
const {size} = await fs.promises.stat(outputPath);
@@ -363,7 +364,12 @@ const innerStillHandler = async <Provider extends CloudProvider>(
forcePathStyle: params.forcePathStyle,
}),
server.closeServer(true),
- sendTelemetryEvent(params.licenseKey ?? params.apiKey, params.logLevel),
+ sendTelemetryEvent(
+ params.licenseKey ?? params.apiKey,
+ params.logLevel,
+ true,
+ null,
+ ),
]);
const estimatedPrice = providerSpecifics.estimatePrice({
diff --git a/packages/web-renderer/src/render-media-on-web.tsx b/packages/web-renderer/src/render-media-on-web.tsx
index f8e5f5e874..c6e1eea9d7 100644
--- a/packages/web-renderer/src/render-media-on-web.tsx
+++ b/packages/web-renderer/src/render-media-on-web.tsx
@@ -456,6 +456,8 @@ const internalRenderMediaOnWeb = async <
licenseKey: licenseKey ?? null,
succeeded: true,
apiName: 'renderMediaOnWeb',
+ isStill: null,
+ isProduction: null,
});
await webFsTarget.close();
@@ -475,6 +477,8 @@ const internalRenderMediaOnWeb = async <
licenseKey: licenseKey ?? null,
succeeded: true,
apiName: 'renderMediaOnWeb',
+ isStill: null,
+ isProduction: null,
});
return {
@@ -495,6 +499,8 @@ const internalRenderMediaOnWeb = async <
succeeded: false,
licenseKey: licenseKey ?? null,
apiName: 'renderMediaOnWeb',
+ isStill: null,
+ isProduction: null,
}).catch((err2) => {
Internals.Log.error(
{logLevel: 'error', tag: 'web-renderer'},
diff --git a/packages/web-renderer/src/render-still-on-web.tsx b/packages/web-renderer/src/render-still-on-web.tsx
index 6f60e53f10..4d47858e60 100644
--- a/packages/web-renderer/src/render-still-on-web.tsx
+++ b/packages/web-renderer/src/render-still-on-web.tsx
@@ -152,6 +152,7 @@ async function internalRenderStillOnWeb<
succeeded: true,
apiName: 'renderStillOnWeb',
isStill: true,
+ isProduction: null,
});
return {blob: imageData, internalState};
@@ -162,6 +163,7 @@ async function internalRenderStillOnWeb<
licenseKey: licenseKey ?? null,
apiName: 'renderStillOnWeb',
isStill: true,
+ isProduction: null,
}).catch((err2) => {
Internals.Log.error(
{logLevel: 'error', tag: 'web-renderer'},
diff --git a/packages/web-renderer/src/send-telemetry-event.ts b/packages/web-renderer/src/send-telemetry-event.ts
index 22d0b8d5a7..3cbc779f6a 100644
--- a/packages/web-renderer/src/send-telemetry-event.ts
+++ b/packages/web-renderer/src/send-telemetry-event.ts
@@ -11,8 +11,8 @@ export const sendUsageEvent = async ({
licenseKey: string | null;
succeeded: boolean;
apiName: string;
- isStill?: boolean;
- isProduction?: boolean;
+ isStill: boolean | null;
+ isProduction: boolean | null;
}) => {
const host =
typeof window === 'undefined'