Skip to content

🎥 Make videos programmatically with React

document progress

Jonny Burgerfa01bf14f88b
diff --git a/packages/docs/docs/lambda-downloadvideo.md b/packages/docs/docs/lambda-downloadvideo.md
index 5ed54dba8c..d9e17bef0f 100644
--- a/packages/docs/docs/lambda-downloadvideo.md
+++ b/packages/docs/docs/lambda-downloadvideo.md
@@ -16,6 +16,13 @@ const { outputPath, sizeInBytes } = await downloadVideo({
region: "us-east-1",
renderId: "8hfxlw",
outPath: "out.mp4",
+ onProgress: ({ totalSize, downloaded, progress }) => {
+ console.log(
+ `Download progress: ${totalSize}/${downloaded} bytes (${(
+ progress * 100
+ ).toFixed(0)}%)`
+ );
+ },
});
console.log(outputPath); // "/Users/yourname/remotion-project/out.mp4"
@@ -54,6 +61,8 @@ The absolute path of where the file got saved.
The size of the file in bytes.
+### `onProgress`
+
## See also
- [renderVideoOnLambda()](/docs/lambda/rendervideoonlambda)
diff --git a/packages/lambda/src/functions/helpers/read-with-progress.ts b/packages/lambda/src/functions/helpers/read-with-progress.ts
index 0f61d37a15..63e9729eba 100644
--- a/packages/lambda/src/functions/helpers/read-with-progress.ts
+++ b/packages/lambda/src/functions/helpers/read-with-progress.ts
@@ -8,7 +8,7 @@ import {getS3Client} from '../../shared/aws-clients';
export type LambdaReadFileProgress = (progress: {
totalSize: number;
downloaded: number;
- percent: number;
+ progress: number;
}) => unknown;
export const lambdaReadFileWithProgress = async ({
@@ -37,7 +37,7 @@ export const lambdaReadFileWithProgress = async ({
stream.on('downloadProgress', ({percent, transferred, total}) => {
onProgress({
downloaded: transferred,
- percent,
+ progress: percent,
totalSize: total,
});
});