Skip to content

🎥 Make videos programmatically with React

apply to lambda

Jonny Burger8b9d7de181cb
diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.ts
index 4d1b2c6816..a942058c29 100644
--- a/packages/lambda/src/api/render-media-on-lambda.ts
+++ b/packages/lambda/src/api/render-media-on-lambda.ts
@@ -169,8 +169,8 @@ export const renderMediaOnLambda = async ({
audioBitrate: audioBitrate ?? null,
videoBitrate: videoBitrate ?? null,
webhook: webhook ?? null,
- height: forceHeight ?? null,
- width: forceWidth ?? null,
+ forceHeight: forceHeight ?? null,
+ forceWidth: forceWidth ?? null,
},
region,
});
diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.ts
index 980ded1b1d..cfc47333d6 100644
--- a/packages/lambda/src/api/render-still-on-lambda.ts
+++ b/packages/lambda/src/api/render-still-on-lambda.ts
@@ -31,8 +31,8 @@ export type RenderStillOnLambdaInput = {
chromiumOptions?: ChromiumOptions;
scale?: number;
downloadBehavior?: DownloadBehavior;
- forceWidth?: number;
- forceHeight?: number;
+ forceWidth?: number | null;
+ forceHeight?: number | null;
};
export type RenderStillOnLambdaOutput = {
@@ -112,8 +112,8 @@ export const renderStillOnLambda = async ({
scale: scale ?? 1,
downloadBehavior: downloadBehavior ?? {type: 'play-in-browser'},
version: VERSION,
- height: forceHeight ?? null,
- width: forceWidth ?? null,
+ forceHeight: forceHeight ?? null,
+ forceWidth: forceWidth ?? null,
},
region,
});
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index 5afcfa3097..29e554535f 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -60,6 +60,8 @@ export const stillCommand = async (args: string[]) => {
quality,
stillFrame,
scale,
+ height,
+ width,
} = await CliInternals.getCliOptions({
type: 'still',
isLambda: true,
@@ -107,6 +109,8 @@ export const stillCommand = async (args: string[]) => {
chromiumOptions,
timeoutInMilliseconds: puppeteerTimeout,
scale,
+ forceHeight: height,
+ forceWidth: width,
});
Log.info(
CliInternals.chalk.gray(
diff --git a/packages/lambda/src/functions/helpers/validate-composition.ts b/packages/lambda/src/functions/helpers/validate-composition.ts
index 08d54417f6..44d51f888b 100644
--- a/packages/lambda/src/functions/helpers/validate-composition.ts
+++ b/packages/lambda/src/functions/helpers/validate-composition.ts
@@ -20,6 +20,8 @@ type ValidateCompositionOptions = {
chromiumOptions: ChromiumOptions;
port: number | null;
downloadMap: DownloadMap;
+ forceHeight: number | null;
+ forceWidth: number | null;
};
export const validateComposition = async ({
@@ -34,6 +36,8 @@ export const validateComposition = async ({
chromiumOptions,
port,
downloadMap,
+ forceHeight,
+ forceWidth,
}: ValidateCompositionOptions): Promise<TCompMetadata> => {
const compositions = await getCompositions(serveUrl, {
puppeteerInstance: browserInstance,
@@ -56,5 +60,9 @@ export const validateComposition = async ({
);
}
- return found;
+ return {
+ ...found,
+ height: forceHeight ?? found.height,
+ width: forceWidth ?? found.width,
+ };
};
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index c1313e82cf..7f248dbe5a 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -164,6 +164,8 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
chromiumOptions: params.chromiumOptions,
port: null,
downloadMap,
+ forceHeight: params.forceHeight,
+ forceWidth: params.forceWidth,
});
Internals.validateDurationInFrames(
comp.durationInFrames,
diff --git a/packages/lambda/src/functions/start.ts b/packages/lambda/src/functions/start.ts
index 6bfa20e28b..3dd8bba76a 100644
--- a/packages/lambda/src/functions/start.ts
+++ b/packages/lambda/src/functions/start.ts
@@ -78,8 +78,8 @@ export const startHandler = async (params: LambdaPayload, options: Options) => {
webhook: params.webhook,
audioBitrate: params.audioBitrate,
videoBitrate: params.videoBitrate,
- height: params.height,
- width: params.width,
+ forceHeight: params.forceHeight,
+ forceWidth: params.forceWidth,
};
await getLambdaClient(getCurrentRegionInFunction()).send(
new InvokeCommand({
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index b101397cd5..82bcfc7217 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -106,6 +106,8 @@ const innerStillHandler = async (
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
port: null,
downloadMap,
+ forceHeight: lambdaParams.forceHeight,
+ forceWidth: lambdaParams.forceWidth,
});
const renderMetadata: RenderMetadata = {
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 91193ba38c..5dbb70f274 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -246,8 +246,8 @@ export type LambdaPayloads = {
audioBitrate: string | null;
videoBitrate: string | null;
webhook: WebhookOption;
- height: number | null;
- width: number | null;
+ forceHeight: number | null;
+ forceWidth: number | null;
};
launch: {
type: LambdaRoutines.launch;
@@ -281,8 +281,8 @@ export type LambdaPayloads = {
audioBitrate: string | null;
videoBitrate: string | null;
webhook: WebhookOption;
- height: number | null;
- width: number | null;
+ forceHeight: number | null;
+ forceWidth: number | null;
};
status: {
type: LambdaRoutines.status;
@@ -343,8 +343,8 @@ export type LambdaPayloads = {
scale: number;
downloadBehavior: DownloadBehavior | null;
version: string;
- height: number | null;
- width: number | null;
+ forceHeight: number | null;
+ forceWidth: number | null;
};
};
diff --git a/packages/lambda/src/test/integration/renders/gif.test.ts b/packages/lambda/src/test/integration/renders/gif.test.ts
index 6fb5f365a1..8173dc9641 100644
--- a/packages/lambda/src/test/integration/renders/gif.test.ts
+++ b/packages/lambda/src/test/integration/renders/gif.test.ts
@@ -64,8 +64,8 @@ test('Should make a distributed GIF', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
- height: null,
- width: null,
+ forceHeight: null,
+ forceWidth: null,
},
extraContext
);
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 1ee543c5ed..7d0e2a5158 100644
--- a/packages/lambda/src/test/integration/renders/old-version.test.ts
+++ b/packages/lambda/src/test/integration/renders/old-version.test.ts
@@ -61,8 +61,8 @@ test('Should fail when using an incompatible version', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
- height: null,
- width: null,
+ forceHeight: null,
+ forceWidth: null,
},
extraContext
)
diff --git a/packages/lambda/src/test/integration/renders/other-bucket.test.ts b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
index 6cc07574ba..3330f422df 100644
--- a/packages/lambda/src/test/integration/renders/other-bucket.test.ts
+++ b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
@@ -67,8 +67,8 @@ test('Should be able to render to another bucket', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
- height: null,
- width: null,
+ forceHeight: null,
+ forceWidth: null,
},
extraContext
);
diff --git a/packages/lambda/src/test/integration/renders/silent-audio.test.ts b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
index bfae26fa9a..19f6906f87 100644
--- a/packages/lambda/src/test/integration/renders/silent-audio.test.ts
+++ b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
@@ -64,8 +64,8 @@ test('Should add silent audio if there is no audio', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
- height: null,
- width: null,
+ forceHeight: null,
+ forceWidth: null,
},
extraContext
);
diff --git a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
index 97e23cfd15..ff638cf061 100644
--- a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
+++ b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
@@ -67,8 +67,8 @@ test('Should make a transparent video', async () => {
webhook: null,
audioBitrate: null,
videoBitrate: null,
- height: null,
- width: null,
+ forceHeight: null,
+ forceWidth: null,
},
extraContext
);
diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.ts
index eb50bfd3c1..a7c1f4ecdc 100644
--- a/packages/lambda/src/test/integration/webhooks.test.ts
+++ b/packages/lambda/src/test/integration/webhooks.test.ts
@@ -103,8 +103,8 @@ describe('Webhooks', () => {
},
audioBitrate: null,
videoBitrate: null,
- height: null,
- width: null,
+ forceHeight: null,
+ forceWidth: null,
},
extraContext
);
@@ -179,8 +179,8 @@ describe('Webhooks', () => {
videoBitrate: null,
bucketName: 'abc',
renderId: 'abc',
- height: null,
- width: null,
+ forceHeight: null,
+ forceWidth: null,
},
{
...extraContext,