Skip to content

🎥 Make videos programmatically with React

Remotion Studio: Fix a case where calculateMetadata() needed Remotion Stuidio to save to apply

Jonny Burgere6ccec213823
diff --git a/packages/core/src/resolve-video-config.ts b/packages/core/src/resolve-video-config.ts
index 018edc9fe3..1fa3ad03ff 100644
--- a/packages/core/src/resolve-video-config.ts
+++ b/packages/core/src/resolve-video-config.ts
@@ -72,23 +72,20 @@ export const resolveVideoConfig = ({
signal: AbortSignal;
inputProps: Record<string, unknown>;
}): VideoConfig | Promise<VideoConfig> => {
+ const originalProps = {
+ ...(composition.defaultProps ?? {}),
+ ...(editorPropsOrUndefined ?? {}),
+ ...(inputProps ?? {}),
+ };
+
const calculatedProm = composition.calculateMetadata
? composition.calculateMetadata({
defaultProps: composition.defaultProps ?? {},
- props: {
- ...(composition.defaultProps ?? {}),
- ...(editorPropsOrUndefined ?? {}),
- ...inputProps,
- },
+ props: originalProps,
abortSignal: signal,
})
: null;
- const fallbackProps = {
- ...(composition.defaultProps ?? {}),
- ...(inputProps ?? {}),
- };
-
if (
calculatedProm !== null &&
typeof calculatedProm === 'object' &&
@@ -107,7 +104,7 @@ export const resolveVideoConfig = ({
durationInFrames,
id: composition.id,
defaultProps: composition.defaultProps ?? {},
- props: c.props ?? fallbackProps,
+ props: c.props ?? originalProps,
defaultCodec: defaultCodec ?? null,
};
});
@@ -123,7 +120,7 @@ export const resolveVideoConfig = ({
...data,
id: composition.id,
defaultProps: composition.defaultProps ?? {},
- props: fallbackProps,
+ props: originalProps,
defaultCodec: null,
};
}
@@ -132,7 +129,7 @@ export const resolveVideoConfig = ({
...data,
id: composition.id,
defaultProps: composition.defaultProps ?? {},
- props: calculatedProm.props ?? fallbackProps,
+ props: calculatedProm.props ?? originalProps,
defaultCodec: calculatedProm.defaultCodec ?? null,
};
};