🎥 Make videos programmatically with React
finish documenting renderStillOnLambda
Jonny Burgere2016c6e947a
diff --git a/packages/docs/docs/getrenderprogress.md b/packages/docs/docs/getrenderprogress.mdindex 09476281cb..489c41e604 100644--- a/packages/docs/docs/getrenderprogress.md+++ b/packages/docs/docs/getrenderprogress.md@@ -111,6 +111,10 @@ How many bytes have been saved to the S3 bucket as a result of this render.How many lambdas that render a chunk have been invoked yet and have started rendering. Note that `lambdasInvoked` and `renderMetadata.estimatedLambdaInvokations` don't match up currently, this is expected.+### `estimatedPrice`++TODO+## See also- [renderVideoOnLambda()](/docs/lambda/rendervideoonlambda)diff --git a/packages/docs/docs/renderstillonlambda.md b/packages/docs/docs/renderstillonlambda.mdindex 70e33429c7..8fde3fc13d 100644--- a/packages/docs/docs/renderstillonlambda.md+++ b/packages/docs/docs/renderstillonlambda.md@@ -61,8 +61,63 @@ The name of the [composition](/docs/composition) you want to render..React props that are passed to your composition. You define the shape of the props that the component accepts.+### `privacy`++Whether the output in the S3 bucket should be public or private. Either `"private"` or `"public"`.++### `frame`++_optional - default `0`_++Which frame of the composition should be rendered.+### `imageFormat?`-_optional - default _+_optional - default `"png"`_++The image format that you want - either `"png"` or `"jpeg"`.++### `quality?`++_optional_++Sets the quality of the generate JPEG images. Must be an integer between 0 and 100. Default is to leave it up to the browser, [current default is 80](https://github.com/chromium/chromium/blob/99314be8152e688bafbbf9a615536bdbb289ea87/headless/lib/browser/protocol/headless_handler.cc#L32).++Only applies if `imageFormat` is `"jpeg"`, otherwise this option is invalid.++### `maxRetries?`++_optional - default `3`_++How often a frame render may be retried until it fails.++### `envVariables?`++_optional - default `{}`_++See [`renderFrames() -> envVariables`](/docs/render-frames#envvariables).++## Return value++Returns a promise resolving to an object with the following properties:++### `bucketName`++The S3 bucket in which the video was saved.++### `output`++An AWS S3 URL where the output is available.++### `estimatedPrice`++Object containing roughly estimated information about how expensive this operation was.++### `size`++The size of the output image in bytes.++## See also-The image format that you want+- [renderVideoOnLambda()](/docs/lambda/rendervideoonlambda)+- [renderStill()](/docs/lambda/renderstill)diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.tsindex ddc0d30cfe..9a5ec570f4 100644--- a/packages/lambda/src/api/render-still-on-lambda.ts+++ b/packages/lambda/src/api/render-still-on-lambda.ts@@ -38,8 +38,8 @@ export const renderStillOnLambda = async ({composition: string;inputProps: unknown;imageFormat: StillImageFormat;- maxRetries: number;privacy: 'private' | 'public';+ maxRetries?: number;envVariables?: Record<string, string>;quality?: number;frame?: number;@@ -54,7 +54,7 @@ export const renderStillOnLambda = async ({imageFormat,envVariables,quality,- maxRetries,+ maxRetries: maxRetries ?? 3,frame: frame ?? 0,privacy,},diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.tsindex d8dabfb44a..bfdd55a631 100644--- a/packages/lambda/src/functions/still.ts+++ b/packages/lambda/src/functions/still.ts@@ -2,6 +2,7 @@ import {InvokeCommand} from '@aws-sdk/client-lambda';import {renderStill} from '@remotion/renderer';import fs from 'fs';import path from 'path';+import {StillImageFormat} from 'remotion';import {getOrCreateBucket} from '../api/get-or-create-bucket';import {estimatePrice} from '../pricing/calculate-price';import {getLambdaClient} from '../shared/aws-clients';@@ -111,8 +112,7 @@ export const innerStillHandler = async (envVariables: lambdaParams.envVariables,// TODO: validateframe: lambdaParams.frame,- // TODO: validate, fix type casting- imageFormat: lambdaParams.imageFormat as 'png',+ imageFormat: lambdaParams.imageFormat as StillImageFormat,inputProps: lambdaParams.inputProps,onError: (error) => {writeLambdaError({@@ -158,6 +158,7 @@ export const innerStillHandler = async (return {output: `https://s3.${getCurrentRegionInFunction()}.amazonaws.com/${bucketName}/${outName}`,size,+ bucketName,estimatedPrice: formatCostsInfo(estimatedPrice),};};