Skip to content

🎥 Make videos programmatically with React

document mostexpensiveframeranges and put it in getRenderProgress()

Jonny Burgerae7830ab316f
diff --git a/packages/docs/docs/lambda/getrenderprogress.md b/packages/docs/docs/lambda/getrenderprogress.md
index f7c490388e..532273d7d2 100644
--- a/packages/docs/docs/lambda/getrenderprogress.md
+++ b/packages/docs/docs/lambda/getrenderprogress.md
@@ -124,6 +124,14 @@ An object describing the costs of the render so far. The cost may increase if th
- `displayCost`: The cost formatted as a string.
- `disclaimer`: Textual disclaimer removing any doubt that there is no guarantee.
+### `mostExpensiveFrameRanges`
+
+If the render is in progress, this is `null`. If the render is done, it is an array of the 5 most expensive chunks in the following shape:
+
+- `chunk`: The index of the chunk (starting from 0)
+- `timeInMilliseconds`: The time it took the render that chunk
+- `frameRange`: A tuple containing the first and last frame that was rendered in that chunk.
+
## See also
- [renderMediaOnLambda()](/docs/lambda/rendermediaonlambda)
diff --git a/packages/lambda/src/functions/helpers/get-progress.ts b/packages/lambda/src/functions/helpers/get-progress.ts
index b9fdd04a4c..9afc6c9fed 100644
--- a/packages/lambda/src/functions/helpers/get-progress.ts
+++ b/packages/lambda/src/functions/helpers/get-progress.ts
@@ -93,6 +93,7 @@ export const getProgress = async ({
retriesInfo: postRenderData.retriesInfo,
outKey: outData.key,
outBucket: outData.renderBucketName,
+ mostExpensiveFrameRanges: postRenderData.mostExpensiveFrameRanges ?? null,
};
}
@@ -270,5 +271,6 @@ export const getProgress = async ({
outputFile && renderMetadata
? getExpectedOutName(renderMetadata, bucketName).renderBucketName
: null,
+ mostExpensiveFrameRanges: null,
};
};
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index f6b1bd8d27..225f4e78d4 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -403,7 +403,7 @@ export type PostRenderData = {
timeToRenderChunks: number;
timeToInvokeLambdas: number;
retriesInfo: ChunkRetry[];
- mostExpensiveFrameRanges: ExpensiveChunk[];
+ mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
};
export type CostsInfo = {
@@ -441,6 +441,7 @@ export type RenderProgress = {
timeToInvokeLambdas: number | null;
overallProgress: number;
retriesInfo: ChunkRetry[];
+ mostExpensiveFrameRanges: ExpensiveChunk[] | null;
};
export type Privacy = 'public' | 'private';