🎥 Make videos programmatically with React
document everything
Jonny Burgera3a5783b71a4
diff --git a/packages/docs/docs/lambda/downloadmedia.md b/packages/docs/docs/lambda/downloadmedia.mdindex 149786b6ee..0241dc35a7 100644--- a/packages/docs/docs/lambda/downloadmedia.md+++ b/packages/docs/docs/lambda/downloadmedia.md@@ -51,12 +51,20 @@ Where the video should be saved. Pass an absolute path, or it will be resolved r### `onProgress`+_optional_+Callback function that gets called with the following properties:- `totalSize` in bytes- `downloaded` number of bytes downloaded- `percent` relative progress between 0 and 1+### `customCredentials`++_optional, available from v3.2.23_++If the render was saved to a [different cloud](/docs/lambda/custom-destination#saving-to-another-cloud), pass an object with the same `endpoint`, `accessKeyId` and `secretAccessKey` as you passed to [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda#outname) or [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda#outname).+## Return valueReturns a promise resolving to an object with the following properties:diff --git a/packages/docs/docs/lambda/getrenderprogress.md b/packages/docs/docs/lambda/getrenderprogress.mdindex 471df1c4b1..5bc9c32968 100644--- a/packages/docs/docs/lambda/getrenderprogress.md+++ b/packages/docs/docs/lambda/getrenderprogress.md@@ -43,6 +43,12 @@ The region in which the Lambda function is located in.The name of the function that triggered the render.+### `customCredentials`++_optional, available from v3.2.23_++If the render is going to be saved to a [different cloud](/docs/lambda/custom-destination#saving-to-another-cloud), pass an object with the same `endpoint`, `accessKeyId` and `secretAccessKey` as you passed to [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda#outname) or [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda#outname).+## ResponseReturns a promise resolving to an object with the following properties:diff --git a/packages/docs/docs/lambda/rendermediaonlambda.md b/packages/docs/docs/lambda/rendermediaonlambda.mdindex 780b2d5c91..002fb33b49 100644--- a/packages/docs/docs/lambda/rendermediaonlambda.md+++ b/packages/docs/docs/lambda/rendermediaonlambda.md@@ -135,13 +135,9 @@ The file name of the media output.It can either be:-- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`. The outName must match `/^([0-9a-zA-Z-!_.*'()/]+)$/g`.+- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`.- A `string` - it will get saved to the same S3 bucket as your site under the key `renders/{renderId}/{outName}`.-- An object of shape `{ key: string; bucketName: string }`. This will save the render to an arbitrary bucket with an arbitrary key. Note the following restrictions:- - You must extend the default Remotion policy to allow read and write access to that bucket.- - The bucket must be in the same region.- - When calling APIs such as `downloadMedia()` or `getRenderProgress()`, you must pass the bucket name where the site resides in, not the bucket where the video gets saved.- - The `key` must match `/^([0-9a-zA-Z-!_.*'()]+)$/g` and the bucketName must match `/^(?=^.{3,63}$)(?!^(\d+\.)+\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$)/`.+- An object if you want to render to a different bucket or cloud provider - [see here for detailed instructions](/docs/lambda/custom-destination)### `timeoutInMilliseconds?`diff --git a/packages/docs/docs/lambda/renderstillonlambda.md b/packages/docs/docs/lambda/renderstillonlambda.mdindex 9eced5afc4..1abdd610f6 100644--- a/packages/docs/docs/lambda/renderstillonlambda.md+++ b/packages/docs/docs/lambda/renderstillonlambda.md@@ -108,17 +108,11 @@ Scales the output dimensions by a factor. See [Scaling](/docs/scaling) to learn_optional_-The file name of the media output.-It can either be:-- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`. The outName must match `/^([0-9a-zA-Z-!_.*'()/]+)$/g`.+- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`.- A `string` - it will get saved to the same S3 bucket as your site under the key `renders/{renderId}/{outName}`.-- An object of shape `{ key: string; bucketName: string }`. This will save the render to an arbitrary bucket with an arbitrary key. Note the following restrictions:- - You must extend the default Remotion policy to allow read and write access to that bucket.- - The bucket must be in the same region.- - When calling APIs such as `downloadMedia()` or `getRenderProgress()`, you must pass the bucket name where the site resides in, not the bucket where the video gets saved.- - The `key` must match `/^([0-9a-zA-Z-!_.*'()]+)$/g` and the bucketName must match `/^(?=^.{3,63}$)(?!^(\d+\.)+\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$)/`.+- An object if you want to render to a different bucket or cloud provider - [see here for detailed instructions](/docs/lambda/custom-destination)### `timeoutInMilliseconds?`diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex f80b66671c..c104ab7c5b 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -310,6 +310,7 @@ module.exports = {"lambda/faq","lambda/light-client","lambda/custom-layers",+ "lambda/custom-destination","lambda/checklist",{type: "category",diff --git a/packages/lambda/src/api/download-media.ts b/packages/lambda/src/api/download-media.tsindex cb64f5722c..e9756b120d 100644--- a/packages/lambda/src/api/download-media.ts+++ b/packages/lambda/src/api/download-media.ts@@ -22,6 +22,18 @@ export type DownloadMediaOutput = {sizeInBytes: number;};+/**+ * @description Triggers a render on a lambda given a composition and a lambda function.+ * @link https://remotion.dev/docs/lambda/downloadmedia+ * @param params.region The AWS region in which the media resides.+ * @param params.bucketName The `bucketName` that was specified during the render.+ * @param params.renderId The `renderId` that was obtainer after triggering the render.+ * @param params.outPath Where to save the media.+ * @param params.onProgress Progress callback function - see docs for details.+ * @param params.customCredentials If the file was saved to a foreign cloud, pass credentials for reading from it.+ * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure+ */+export const downloadMedia = async (input: DownloadMediaInput): Promise<DownloadMediaOutput> => {diff --git a/packages/lambda/src/api/get-render-progress.ts b/packages/lambda/src/api/get-render-progress.tsindex ffe3262a14..b337f0742f 100644--- a/packages/lambda/src/api/get-render-progress.ts+++ b/packages/lambda/src/api/get-render-progress.ts@@ -37,7 +37,7 @@ export const getRenderProgress = async ({bucketName,renderId,version: VERSION,- customS3Implementation: s3OutputProvider,+ s3OutputProvider,},region,});diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.tsindex f32e9ed72e..a45872675d 100644--- a/packages/lambda/src/api/render-media-on-lambda.ts+++ b/packages/lambda/src/api/render-media-on-lambda.ts@@ -62,14 +62,14 @@ export type RenderMediaOnLambdaOutput = {* @param params.serveUrl The URL of the deployed project* @param params.composition The ID of the composition which should be rendered.* @param params.inputProps The input props that should be passed to the composition.- * @param params.codec The video codec which should be used for encoding.+ * @param params.codec The media codec which should be used for encoding.* @param params.imageFormat In which image format the frames should be rendered.* @param params.crf The constant rate factor to be used during encoding.* @param params.envVariables Object containing environment variables to be inserted into the video environment* @param params.proResProfile The ProRes profile if rendering a ProRes video* @param params.quality JPEG quality if JPEG was selected as the image format.- * @param params.region The AWS region in which the video should be rendered.- * @param params.maxRetries How often rendering a chunk may fail before the video render gets aborted.+ * @param params.region The AWS region in which the media should be rendered.+ * @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted.* @param params.logLevel Level of logging that Lambda function should perform. Default "info".* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure*/diff --git a/packages/lambda/src/functions/helpers/expected-out-name.ts b/packages/lambda/src/functions/helpers/expected-out-name.tsindex 30715cf91f..6e0bf42327 100644--- a/packages/lambda/src/functions/helpers/expected-out-name.ts+++ b/packages/lambda/src/functions/helpers/expected-out-name.ts@@ -21,7 +21,7 @@ export const getCredentialsFromOutName = (return null;}- return name.customS3Implementation ?? null;+ return name.s3OutputProvider ?? null;};export const getExpectedOutName = (diff --git a/packages/lambda/src/functions/helpers/get-custom-out-name.ts b/packages/lambda/src/functions/helpers/get-custom-out-name.tsindex e6ca36c1cc..51c6f0f306 100644--- a/packages/lambda/src/functions/helpers/get-custom-out-name.ts+++ b/packages/lambda/src/functions/helpers/get-custom-out-name.ts@@ -16,7 +16,7 @@ export const getCustomOutName = ({return renderMetadata.outName;}- if (renderMetadata.outName.customS3Implementation) {+ if (renderMetadata.outName.s3OutputProvider) {if (!customCredentials && renderMetadata.privacy !== 'public') {throw new TypeError(`The file was rendered with a custom S3 implementation and is not public, but no custom credentials were passed to downloadMedia().`@@ -26,8 +26,8 @@ export const getCustomOutName = ({return {bucketName: renderMetadata.outName.bucketName,key: renderMetadata.outName.key,- customS3Implementation: {- endpoint: renderMetadata.outName.customS3Implementation.endpoint,+ s3OutputProvider: {+ endpoint: renderMetadata.outName.s3OutputProvider.endpoint,accessKeyId: customCredentials?.accessKeyId ?? null,secretAccessKey: customCredentials?.secretAccessKey ?? null,},diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.tsindex f46170ac9a..276e061d70 100644--- a/packages/lambda/src/functions/launch.ts+++ b/packages/lambda/src/functions/launch.ts@@ -344,7 +344,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {params.bucketName,typeof params.outName === 'string' || typeof params.outName === 'undefined'? null- : params.outName?.customS3Implementation ?? null+ : params.outName?.s3OutputProvider ?? null);const outputSize = fs.statSync(outfile);diff --git a/packages/lambda/src/functions/progress.ts b/packages/lambda/src/functions/progress.tsindex 1535c0edde..7e7c384948 100644--- a/packages/lambda/src/functions/progress.ts+++ b/packages/lambda/src/functions/progress.ts@@ -36,6 +36,6 @@ export const progressHandler = (region: getCurrentRegionInFunction(),memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),timeoutInMiliseconds: options.timeoutInMiliseconds,- customCredentials: lambdaParams.customS3Implementation ?? null,+ customCredentials: lambdaParams.s3OutputProvider ?? null,});};diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.tsindex 7073a71aad..70c5b87da6 100644--- a/packages/lambda/src/shared/constants.ts+++ b/packages/lambda/src/shared/constants.ts@@ -132,7 +132,7 @@ export type OutNameInput =| {bucketName: string;key: string;- customS3Implementation?: CustomS3Credentials;+ s3OutputProvider?: CustomS3Credentials;};export type OutNameInputWithoutCredentials =@@ -140,7 +140,7 @@ export type OutNameInputWithoutCredentials =| {bucketName: string;key: string;- customS3Implementation?: CustomCredentialsWithoutSensitiveData;+ s3OutputProvider?: CustomCredentialsWithoutSensitiveData;};export type OutNameOutput = {@@ -172,7 +172,7 @@ export const customOutName = (return {key: name.key,renderBucketName: name.bucketName,- customCredentials: name.customS3Implementation ?? null,+ customCredentials: name.s3OutputProvider ?? null,};};@@ -260,7 +260,7 @@ export type LambdaPayloads = {bucketName: string;renderId: string;version: string;- customS3Implementation?: CustomS3Credentials;+ s3OutputProvider?: CustomS3Credentials;};renderer: {concurrencyPerLambda: number;