Skip to content

🎥 Make videos programmatically with React

Add licenseKey to lambda and webcodecs functions:

Pramod71b2bb5a5588
diff --git a/packages/lambda-client/src/render-media-on-lambda.ts b/packages/lambda-client/src/render-media-on-lambda.ts
index fa586b26ea..50eac45c72 100644
--- a/packages/lambda-client/src/render-media-on-lambda.ts
+++ b/packages/lambda-client/src/render-media-on-lambda.ts
@@ -197,6 +197,7 @@ export const renderMediaOnLambdaOptionalToRequired = (
indent: false,
metadata: options.metadata ?? null,
apiKey: options.apiKey ?? null,
+ licenseKey: options.licenseKey ?? null,
storageClass: options.storageClass ?? null,
requestHandler: options.requestHandler ?? null,
mediaCacheSizeInBytes: options.mediaCacheSizeInBytes ?? null,
diff --git a/packages/lambda-client/src/render-still-on-lambda.ts b/packages/lambda-client/src/render-still-on-lambda.ts
index 8bf3f7b423..d06cd808d7 100644
--- a/packages/lambda-client/src/render-still-on-lambda.ts
+++ b/packages/lambda-client/src/render-still-on-lambda.ts
@@ -201,6 +201,7 @@ export const renderStillOnLambda = (
timeoutInMilliseconds: input.timeoutInMilliseconds ?? 30000,
forcePathStyle: input.forcePathStyle ?? false,
apiKey: input.apiKey ?? null,
+ licenseKey: input.licenseKey ?? null,
offthreadVideoThreads: input.offthreadVideoThreads ?? null,
storageClass: input.storageClass ?? null,
requestHandler: input.requestHandler ?? null,
diff --git a/packages/renderer/src/options/options-map.ts b/packages/renderer/src/options/options-map.ts
index a7b96c4cd0..9019923d8b 100644
--- a/packages/renderer/src/options/options-map.ts
+++ b/packages/renderer/src/options/options-map.ts
@@ -76,6 +76,7 @@ export const optionsMap = {
onBrowserDownload: onBrowserDownloadOption,
chromeMode: chromeModeOption,
apiKey: apiKeyOption,
+ licenseKey: licenseKeyOption,
},
getCompositions: {
mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,
@@ -127,6 +128,7 @@ export const optionsMap = {
logLevel: logLevelOption,
timeoutInMilliseconds: delayRenderTimeoutInMillisecondsOption,
apiKey: apiKeyOption,
+ licenseKey: licenseKeyOption,
},
renderStillOnLambda: {
mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,
@@ -138,6 +140,7 @@ export const optionsMap = {
scale: scaleOption,
timeoutInMilliseconds: delayRenderTimeoutInMillisecondsOption,
apiKey: apiKeyOption,
+ licenseKey: licenseKeyOption,
},
getCompositionsOnLambda: {
mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index d1027903e3..495bd7a589 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -426,6 +426,7 @@ const internalRenderStillRaw = (
registerUsageEvent({
apiKey: options.apiKey,
+ licenseKey: options.licenseKey,
event: 'cloud-render',
host: null,
succeeded: true,
@@ -503,6 +504,7 @@ export const renderStill = (
offthreadVideoThreads,
mediaCacheSizeInBytes,
apiKey,
+ licenseKey,
} = options;
if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
@@ -570,6 +572,7 @@ export const renderStill = (
offthreadVideoThreads: offthreadVideoThreads ?? null,
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
apiKey: apiKey ?? null,
+ licenseKey: licenseKey ?? null,
onLog: defaultOnLog,
});
};
diff --git a/packages/webcodecs/src/convert-media.ts b/packages/webcodecs/src/convert-media.ts
index 522990ad71..bdb8ef8100 100644
--- a/packages/webcodecs/src/convert-media.ts
+++ b/packages/webcodecs/src/convert-media.ts
@@ -97,6 +97,7 @@ export const convertMedia = async function <
progressIntervalInMs,
rotate,
apiKey,
+ licenseKey,
resize,
onAudioCodec,
onContainer,
@@ -153,7 +154,11 @@ export const convertMedia = async function <
progressIntervalInMs?: number;
rotate?: number;
resize?: ResizeOperation;
+ /**
+ * @deprecated Use `licenseKey` instead
+ */
apiKey?: string | null;
+ licenseKey?: string | null;
fields?: F;
seekingHints?: ParseMediaOptions<F>['seekingHints'];
} & MediaParserInternalTypes['ParseMediaCallbacks']): Promise<ConvertMediaResult> {
@@ -357,16 +362,20 @@ export const convertMedia = async function <
});
})
.then(() => {
- sendUsageEvent({succeeded: true, apiKey: apiKey ?? null}).catch((err) => {
+ sendUsageEvent({
+ succeeded: true,
+ licenseKey: licenseKey ?? apiKey ?? null,
+ }).catch((err) => {
Log.error('Failed to send usage event', err);
});
})
.catch((err) => {
- sendUsageEvent({succeeded: false, apiKey: apiKey ?? null}).catch(
- (err2) => {
- Log.error('Failed to send usage event', err2);
- },
- );
+ sendUsageEvent({
+ succeeded: false,
+ licenseKey: licenseKey ?? apiKey ?? null,
+ }).catch((err2) => {
+ Log.error('Failed to send usage event', err2);
+ });
reject(err);
})
.finally(() => {
diff --git a/packages/webcodecs/src/send-telemetry-event.ts b/packages/webcodecs/src/send-telemetry-event.ts
index fa6e4f3eaa..8eadcb11f7 100644
--- a/packages/webcodecs/src/send-telemetry-event.ts
+++ b/packages/webcodecs/src/send-telemetry-event.ts
@@ -1,10 +1,10 @@
import {registerUsageEvent} from '@remotion/licensing';
export const sendUsageEvent = async ({
- apiKey,
+ licenseKey,
succeeded,
}: {
- apiKey: string | null;
+ licenseKey: string | null;
succeeded: boolean;
}) => {
const host =
@@ -18,7 +18,8 @@ export const sendUsageEvent = async ({
}
await registerUsageEvent({
- apiKey,
+ apiKey: null,
+ licenseKey,
event: 'webcodec-conversion',
host,
succeeded,