Skip to content

🎥 Make videos programmatically with React

bundling progress

Jonny Burgeraf1982ff74d0
diff --git a/packages/cli/src/editor/components/CompositionSelectorItem.tsx b/packages/cli/src/editor/components/CompositionSelectorItem.tsx
index cc810455ec..1edec87c2f 100644
--- a/packages/cli/src/editor/components/CompositionSelectorItem.tsx
+++ b/packages/cli/src/editor/components/CompositionSelectorItem.tsx
@@ -174,6 +174,7 @@ export const CompositionSelectorItem: React.FC<{
);
}
+ // TODO: Button nested inside of button
return (
<Row align="center">
<button
diff --git a/packages/cli/src/progress-bar.ts b/packages/cli/src/progress-bar.ts
index a27755b22d..fb223d3658 100644
--- a/packages/cli/src/progress-bar.ts
+++ b/packages/cli/src/progress-bar.ts
@@ -208,7 +208,7 @@ export type AggregateRenderProgress = {
rendering: RenderingProgressInput | null;
stitching: StitchingProgressInput | null;
downloads: DownloadProgress[];
- bundling: number;
+ bundling: {progress: number; message: string | null};
};
export const makeRenderingAndStitchingProgress = (
@@ -231,14 +231,14 @@ export const makeRenderingAndStitchingProgress = (
: 0;
// TODO: Factor in stitching progress
- const progress = bundling * 0.3 + renderProgress * 0.7;
+ const progress = bundling.progress * 0.3 + renderProgress * 0.7;
return {output, progress, message: getMessage(prog)};
};
export const getMessage = (progress: AggregateRenderProgress): string => {
- if (progress.bundling < 1) {
- return `Bundling ${Math.round(progress.bundling * 100)}%`;
+ if (progress.bundling.progress < 1 && progress.bundling.message) {
+ return progress.bundling.message;
}
// TODO: Better message than "Rendering..."
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index b4ea479923..f624ed0a82 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -102,7 +102,10 @@ export const renderStillFlow = async ({
rendering: null,
downloads,
stitching: null,
- bundling: 1,
+ bundling: {
+ message: null,
+ progress: 0,
+ },
};
let renderProgress: OverwriteableCliOutput | null = null;
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 5b5291a995..fabcf3326f 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -248,7 +248,10 @@ export const render = async (remotionRoot: string, args: string[]) => {
codec,
},
downloads,
- bundling: 1,
+ bundling: {
+ message: 'Bundled',
+ progress: 1,
+ },
});
return renderProgress.update(output);
};
diff --git a/packages/cli/src/setup-cache.ts b/packages/cli/src/setup-cache.ts
index ea9bda54dc..729fb1df4f 100644
--- a/packages/cli/src/setup-cache.ts
+++ b/packages/cli/src/setup-cache.ts
@@ -26,7 +26,7 @@ export const bundleOnCliOrTakeServeUrl = async ({
remotionRoot: string;
steps: RenderStep[];
publicDir: string | null;
- onProgress: (prog: number) => void;
+ onProgress: (params: {progress: number; message: string}) => void;
}): Promise<{
urlOrBundle: string;
cleanup: () => Promise<void>;
@@ -43,7 +43,7 @@ export const bundleOnCliOrTakeServeUrl = async ({
remotionRoot,
steps,
publicDir,
- onProgress,
+ onProgressCallback: onProgress,
});
return {
@@ -57,13 +57,13 @@ export const bundleOnCli = async ({
steps,
remotionRoot,
publicDir,
- onProgress: progCallback,
+ onProgressCallback,
}: {
fullPath: string;
steps: RenderStep[];
remotionRoot: string;
publicDir: string | null;
- onProgress: (prog: number) => void;
+ onProgressCallback: (params: {progress: number; message: string}) => void;
}) => {
const shouldCache = ConfigInternals.getWebpackCaching();
@@ -96,7 +96,10 @@ export const bundleOnCli = async ({
}) + (newline ? '\n' : '')
);
// TODO: Take copying into account
- progCallback(bundlingState.progress);
+ onProgressCallback({
+ progress: bundlingState.progress,
+ message: `Bundling (${Math.round(bundlingState.progress * 100)}%)`,
+ });
};
const onPublicDirCopyProgress = (bytes: number) => {