Skip to content

🎥 Make videos programmatically with React

Add isProduction to lambda-client

Pramodd3d6eb8877bf
diff --git a/packages/lambda-client/src/make-lambda-payload.ts b/packages/lambda-client/src/make-lambda-payload.ts
index ddb73688ff..a009c25000 100644
--- a/packages/lambda-client/src/make-lambda-payload.ts
+++ b/packages/lambda-client/src/make-lambda-payload.ts
@@ -88,6 +88,7 @@ export type InnerRenderMediaOnLambdaInput = {
metadata: Record<string, string> | null;
storageClass: StorageClass | null;
requestHandler: RequestHandler | null;
+ isProduction?: boolean;
} & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
export const makeLambdaRenderMediaPayload = async ({
@@ -141,6 +142,7 @@ export const makeLambdaRenderMediaPayload = async ({
offthreadVideoThreads,
storageClass,
requestHandler,
+ isProduction,
}: InnerRenderMediaOnLambdaInput): Promise<
ServerlessStartPayload<AwsProvider>
> => {
@@ -223,6 +225,7 @@ export const makeLambdaRenderMediaPayload = async ({
offthreadVideoThreads: offthreadVideoThreads ?? null,
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
storageClass: storageClass ?? null,
+ isProduction,
};
};
@@ -273,6 +276,7 @@ export const makeLambdaRenderStillPayload = async ({
requestHandler,
offthreadVideoThreads,
mediaCacheSizeInBytes,
+ isProduction,
}: RenderStillOnLambdaNonNullInput): Promise<
ServerlessPayloads<AwsProvider>[ServerlessRoutines.still]
> => {
@@ -328,5 +332,6 @@ export const makeLambdaRenderStillPayload = async ({
offthreadVideoThreads: offthreadVideoThreads ?? null,
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
storageClass: storageClass ?? null,
+ isProduction,
};
};
diff --git a/packages/lambda-client/src/render-media-on-lambda.ts b/packages/lambda-client/src/render-media-on-lambda.ts
index 50eac45c72..423265c0e7 100644
--- a/packages/lambda-client/src/render-media-on-lambda.ts
+++ b/packages/lambda-client/src/render-media-on-lambda.ts
@@ -74,6 +74,7 @@ export type RenderMediaOnLambdaInput = {
metadata?: Record<string, string> | null;
storageClass?: StorageClass | null;
requestHandler?: RequestHandler;
+ isProduction?: boolean;
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
export type RenderMediaOnLambdaOutput = {
@@ -201,6 +202,7 @@ export const renderMediaOnLambdaOptionalToRequired = (
storageClass: options.storageClass ?? null,
requestHandler: options.requestHandler ?? null,
mediaCacheSizeInBytes: options.mediaCacheSizeInBytes ?? null,
+ isProduction: options.isProduction,
};
};
diff --git a/packages/lambda-client/src/render-still-on-lambda.ts b/packages/lambda-client/src/render-still-on-lambda.ts
index d06cd808d7..20bb7d14ac 100644
--- a/packages/lambda-client/src/render-still-on-lambda.ts
+++ b/packages/lambda-client/src/render-still-on-lambda.ts
@@ -52,6 +52,7 @@ type OptionalParameters = {
forcePathStyle: boolean;
storageClass: StorageClass | null;
requestHandler: RequestHandler | null | undefined;
+ isProduction?: boolean;
} & ToOptions<typeof BrowserSafeApis.optionsMap.renderStillOnLambda>;
export type RenderStillOnLambdaNonNullInput = MandatoryParameters &
@@ -206,5 +207,6 @@ export const renderStillOnLambda = (
storageClass: input.storageClass ?? null,
requestHandler: input.requestHandler ?? null,
mediaCacheSizeInBytes: input.mediaCacheSizeInBytes ?? null,
+ isProduction: input.isProduction,
});
};
diff --git a/packages/licensing/src/register-usage-event.ts b/packages/licensing/src/register-usage-event.ts
index 7c0c5b37ef..2eee75ef71 100644
--- a/packages/licensing/src/register-usage-event.ts
+++ b/packages/licensing/src/register-usage-event.ts
@@ -55,12 +55,14 @@ export const registerUsageEvent = async ({
succeeded,
event,
isStill,
+ isProduction,
...apiOrLicenseKey
}: {
host: string | null;
succeeded: boolean;
event: UsageEventType;
isStill?: boolean;
+ isProduction?: boolean;
} & EitherApiKeyOrLicenseKey): Promise<RegisterUsageEventResponse> => {
const apiKey = 'apiKey' in apiOrLicenseKey ? apiOrLicenseKey.apiKey : null;
const licenseKey =
@@ -84,6 +86,7 @@ export const registerUsageEvent = async ({
host,
succeeded,
isStill,
+ isProduction,
}),
headers: {
'Content-Type': 'application/json',
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index b0dd5d00dd..e892a3a163 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -151,6 +151,7 @@ export type InternalRenderMediaOptions = {
onArtifact: OnArtifact | null;
metadata: Record<string, string> | null;
onLog: OnLog;
+ isProduction?: boolean;
} & EitherApiKeyOrLicenseKey &
MoreRenderMediaOptions;
@@ -209,6 +210,7 @@ export type RenderMediaOptions = Prettify<{
onArtifact?: OnArtifact;
metadata?: Record<string, string> | null;
compositionStart?: number;
+ isProduction?: boolean;
}> &
EitherApiKeyOrLicenseKey &
Partial<MoreRenderMediaOptions>;
@@ -280,6 +282,7 @@ const internalRenderMediaRaw = ({
mediaCacheSizeInBytes,
onLog,
licenseKey,
+ isProduction,
}: InternalRenderMediaOptions): Promise<RenderMediaResult> => {
const pixelFormat =
userPixelFormat ??
@@ -836,6 +839,7 @@ const internalRenderMediaRaw = ({
host: null,
succeeded: true,
licenseKey: licenseKey ?? null,
+ isProduction,
})
.then(() => {
Log.verbose({indent, logLevel}, 'Usage event sent successfully');
@@ -992,6 +996,7 @@ export const renderMedia = ({
offthreadVideoThreads,
compositionStart,
mediaCacheSizeInBytes,
+ isProduction,
...apiKeyOrLicenseKey
}: RenderMediaOptions): Promise<RenderMediaResult> => {
const indent = false;
@@ -1086,5 +1091,6 @@ export const renderMedia = ({
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
licenseKey: licenseKey ?? apiKey ?? null,
onLog: defaultOnLog,
+ isProduction,
});
};
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index e65d06e056..8247aa8983 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -76,6 +76,7 @@ type InternalRenderStillOptions = {
port: number | null;
onArtifact: OnArtifact | null;
onLog: OnLog;
+ isProduction?: boolean;
} & ToOptions<typeof optionsMap.renderStill>;
export type RenderStillOptions = {
@@ -108,6 +109,7 @@ export type RenderStillOptions = {
*/
quality?: never;
onArtifact?: OnArtifact;
+ isProduction?: boolean;
} & Partial<ToOptions<typeof optionsMap.renderStill>>;
type CleanupFn = () => Promise<unknown>;
@@ -430,6 +432,7 @@ const internalRenderStillRaw = (
host: null,
succeeded: true,
isStill: true,
+ isProduction: options.isProduction,
})
.then(() => {
Log.verbose(options, 'Usage event sent successfully');
@@ -505,6 +508,7 @@ export const renderStill = (
mediaCacheSizeInBytes,
apiKey,
licenseKey,
+ isProduction,
} = options;
if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
@@ -574,5 +578,6 @@ export const renderStill = (
apiKey: apiKey ?? null,
licenseKey: licenseKey ?? null,
onLog: defaultOnLog,
+ isProduction,
});
};
diff --git a/packages/serverless-client/src/constants.ts b/packages/serverless-client/src/constants.ts
index ab8e8d0ddd..2a2d599559 100644
--- a/packages/serverless-client/src/constants.ts
+++ b/packages/serverless-client/src/constants.ts
@@ -161,6 +161,7 @@ export type ServerlessStartPayload<Provider extends CloudProvider> = {
apiKey: string | null;
licenseKey: string | null;
storageClass: Provider['storageClass'] | null;
+ isProduction?: boolean;
};
export type ServerlessPayloads<Provider extends CloudProvider> = {
@@ -304,6 +305,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
apiKey: string | null;
licenseKey: string | null;
storageClass: Provider['storageClass'] | null;
+ isProduction?: boolean;
};
compositions: {
type: ServerlessRoutines.compositions;
diff --git a/packages/serverless/src/handlers/send-telemetry-event.ts b/packages/serverless/src/handlers/send-telemetry-event.ts
index a792511a9f..236f648085 100644
--- a/packages/serverless/src/handlers/send-telemetry-event.ts
+++ b/packages/serverless/src/handlers/send-telemetry-event.ts
@@ -6,6 +6,7 @@ export const sendTelemetryEvent = async (
licenseKey: string | null,
logLevel: LogLevel,
isStill?: boolean,
+ isProduction?: boolean,
) => {
if (licenseKey === null) {
return Promise.resolve();
@@ -19,6 +20,7 @@ export const sendTelemetryEvent = async (
host: null,
succeeded: true,
isStill,
+ isProduction,
});
RenderInternals.Log.info({indent: false, logLevel}, 'Telemetry event sent');
} catch (err) {
diff --git a/packages/web-renderer/src/send-telemetry-event.ts b/packages/web-renderer/src/send-telemetry-event.ts
index 1178e075b6..22d0b8d5a7 100644
--- a/packages/web-renderer/src/send-telemetry-event.ts
+++ b/packages/web-renderer/src/send-telemetry-event.ts
@@ -6,11 +6,13 @@ export const sendUsageEvent = async ({
succeeded,
apiName,
isStill,
+ isProduction,
}: {
licenseKey: string | null;
succeeded: boolean;
apiName: string;
isStill?: boolean;
+ isProduction?: boolean;
}) => {
const host =
typeof window === 'undefined'
@@ -35,5 +37,6 @@ export const sendUsageEvent = async ({
host,
succeeded,
isStill,
+ isProduction,
});
};