Skip to content

🎥 Make videos programmatically with React

`remotion`: Inherit freeze in sequence wrappers

Jonny Burger8c34f224ccbf
diff --git a/packages/core/src/HtmlInCanvas.tsx b/packages/core/src/HtmlInCanvas.tsx
index fc85cbbaa8..b74796d485 100644
--- a/packages/core/src/HtmlInCanvas.tsx
+++ b/packages/core/src/HtmlInCanvas.tsx
@@ -19,6 +19,7 @@ import {
import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';
import {
durationInFramesField,
+ freezeField,
fromField,
hiddenField,
sequenceVisualStyleSchema,
@@ -699,6 +700,7 @@ HtmlInCanvasInner.displayName = 'HtmlInCanvas';
const htmlInCanvasSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
...sequenceVisualStyleSchema,
hidden: hiddenField,
};
diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsx
index fb2cb98f56..0ea7a3939a 100644
--- a/packages/core/src/Img.tsx
+++ b/packages/core/src/Img.tsx
@@ -12,6 +12,7 @@ import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';
import {getCrossOriginValue} from './get-cross-origin-value.js';
import {usePreload} from './prefetch.js';
import {
+ freezeField,
fromField,
hiddenField,
sequenceVisualStyleSchema,
@@ -53,7 +54,7 @@ export type ImgProps = NativeImgProps & {
* @deprecated For internal use only
*/
readonly stack?: string;
-} & Pick<SequenceProps, 'durationInFrames' | 'from' | 'hidden'>;
+} & Pick<SequenceProps, 'durationInFrames' | 'from' | 'freeze' | 'hidden'>;
type Expected = Omit<
NativeImgProps,
@@ -68,6 +69,7 @@ type ImgContentProps = Omit<
| 'showInTimeline'
| 'from'
| 'durationInFrames'
+ | 'freeze'
| 'effects'
> & {
readonly refForOutline: React.RefObject<HTMLElement | null>;
@@ -324,6 +326,7 @@ const NativeImgInner: React.FC<NativeImgInnerProps> = ({
src,
from,
durationInFrames,
+ freeze,
_experimentalControls: controls,
_remotionInternalRefForOutline: refForOutline,
...props
@@ -337,6 +340,7 @@ const NativeImgInner: React.FC<NativeImgInnerProps> = ({
layout="none"
from={from ?? 0}
durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
_remotionInternalStack={stack}
_remotionInternalDocumentationLink={
name === undefined ? 'https://www.remotion.dev/docs/img' : undefined
@@ -363,6 +367,7 @@ const CanvasImageWithPrivateProps = CanvasImage as React.ComponentType<
export const imgSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
...sequenceVisualStyleSchema,
hidden: hiddenField,
} as const satisfies SequenceSchema;
@@ -456,6 +461,7 @@ const ImgInner: React.FC<
src,
from,
durationInFrames,
+ freeze,
_experimentalControls: controls,
width,
height,
@@ -482,6 +488,7 @@ const ImgInner: React.FC<
src={src}
from={from}
durationInFrames={durationInFrames}
+ freeze={freeze}
_experimentalControls={controls}
width={width}
height={height}
@@ -529,6 +536,7 @@ const ImgInner: React.FC<
delayRenderTimeoutInMilliseconds={delayRenderTimeoutInMilliseconds}
from={from}
durationInFrames={durationInFrames}
+ freeze={freeze}
hidden={hidden}
name={name ?? '<Img>'}
showInTimeline={showInTimeline}
diff --git a/packages/core/src/Interactive.tsx b/packages/core/src/Interactive.tsx
index d753f4ad0c..24b6451b7a 100644
--- a/packages/core/src/Interactive.tsx
+++ b/packages/core/src/Interactive.tsx
@@ -3,6 +3,7 @@ import type {SequenceControls} from './CompositionManager.js';
import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';
import {
durationInFramesField,
+ freezeField,
fromField,
hiddenField,
sequenceVisualStyleSchema,
@@ -62,7 +63,7 @@ type ElementForTag<Tag extends InteractiveTag> =
type InteractiveSequenceProps = Pick<
SequenceProps,
- 'durationInFrames' | 'from' | 'hidden' | 'name' | 'showInTimeline'
+ 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'
> & {
/**
* @deprecated For internal use only
@@ -84,6 +85,7 @@ type InteractiveElementComponent<Tag extends InteractiveTag> =
const interactiveElementSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
...sequenceVisualStyleSchema,
hidden: hiddenField,
} as const satisfies SequenceSchema;
@@ -115,6 +117,7 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(
const {
durationInFrames,
from,
+ freeze,
hidden,
name,
showInTimeline,
@@ -138,6 +141,7 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(
layout="none"
from={from ?? 0}
durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
hidden={hidden}
name={name ?? displayName}
showInTimeline={showInTimeline ?? true}
diff --git a/packages/core/src/animated-image/AnimatedImage.tsx b/packages/core/src/animated-image/AnimatedImage.tsx
index e8871d66f4..e1c6694b32 100644
--- a/packages/core/src/animated-image/AnimatedImage.tsx
+++ b/packages/core/src/animated-image/AnimatedImage.tsx
@@ -17,6 +17,7 @@ import {
import {addSequenceStackTraces} from '../enable-sequence-stack-traces.js';
import {
durationInFramesField,
+ freezeField,
fromField,
hiddenField,
sequenceVisualStyleSchema,
@@ -38,6 +39,7 @@ import {resolveAnimatedImageSource} from './resolve-image-source';
const animatedImageSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
playbackRate: {
type: 'number',
min: 0,
diff --git a/packages/core/src/canvas-image/CanvasImage.tsx b/packages/core/src/canvas-image/CanvasImage.tsx
index ed5bd82eb1..9ae3052c1b 100644
--- a/packages/core/src/canvas-image/CanvasImage.tsx
+++ b/packages/core/src/canvas-image/CanvasImage.tsx
@@ -21,6 +21,7 @@ import {
import {addSequenceStackTraces} from '../enable-sequence-stack-traces.js';
import {usePreload} from '../prefetch.js';
import {
+ freezeField,
fromField,
hiddenField,
sequenceVisualStyleSchema,
@@ -38,6 +39,7 @@ import type {CanvasImageCanvasProps, CanvasImageProps} from './props.js';
export const canvasImageSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
fit: {
type: 'enum',
default: 'fill',
@@ -413,6 +415,7 @@ const CanvasImageInner = forwardRef<
delayRenderTimeoutInMilliseconds,
durationInFrames,
from,
+ freeze,
hidden,
name,
showInTimeline,
@@ -439,6 +442,7 @@ const CanvasImageInner = forwardRef<
layout="none"
from={from ?? 0}
durationInFrames={durationInFrames ?? Infinity}
+ freeze={freeze}
hidden={hidden}
showInTimeline={showInTimeline ?? true}
name={name ?? '<CanvasImage>'}
diff --git a/packages/core/src/canvas-image/props.ts b/packages/core/src/canvas-image/props.ts
index e246280f89..165008816d 100644
--- a/packages/core/src/canvas-image/props.ts
+++ b/packages/core/src/canvas-image/props.ts
@@ -5,7 +5,7 @@ import type {SequenceProps} from '../Sequence.js';
type CanvasImageSequenceProps = Pick<
SequenceProps,
- 'durationInFrames' | 'from' | 'hidden' | 'name' | 'showInTimeline'
+ 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'
> & {
/**
* @deprecated For internal use only.
diff --git a/packages/core/src/effects/Solid.tsx b/packages/core/src/effects/Solid.tsx
index 6dcc1f6558..53a52da14e 100644
--- a/packages/core/src/effects/Solid.tsx
+++ b/packages/core/src/effects/Solid.tsx
@@ -11,6 +11,7 @@ import type {SequenceControls} from '../CompositionManager.js';
import {addSequenceStackTraces} from '../enable-sequence-stack-traces.js';
import {
durationInFramesField,
+ freezeField,
fromField,
hiddenField,
sequenceVisualStyleSchema,
@@ -68,6 +69,7 @@ export type SolidProps = MandatoryProps & Partial<OptionalProps>;
const solidSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
color: {
type: 'color',
default: 'transparent',
@@ -237,7 +239,12 @@ const SolidOuter = forwardRef<
readonly _experimentalControls: SequenceControls | undefined;
} & Pick<
SequenceProps,
- 'durationInFrames' | 'name' | 'from' | 'showInTimeline' | 'hidden'
+ | 'durationInFrames'
+ | 'name'
+ | 'from'
+ | 'freeze'
+ | 'showInTimeline'
+ | 'hidden'
>
>(
(
@@ -252,6 +259,7 @@ const SolidOuter = forwardRef<
style,
name,
from,
+ freeze,
hidden,
showInTimeline,
pixelDensity,
@@ -272,6 +280,7 @@ const SolidOuter = forwardRef<
<Sequence
layout="none"
from={from}
+ freeze={freeze}
hidden={hidden}
showInTimeline={showInTimeline}
_experimentalControls={controls}
diff --git a/packages/gif/src/Gif.tsx b/packages/gif/src/Gif.tsx
index 23c1c5cbd2..bddf7e359e 100644
--- a/packages/gif/src/Gif.tsx
+++ b/packages/gif/src/Gif.tsx
@@ -19,6 +19,7 @@ const {
useMemoizedEffects,
wrapInSchema,
durationInFramesField,
+ freezeField,
fromField,
} = Internals;
@@ -38,6 +39,7 @@ export type GifProps = Omit<
const gifSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
playbackRate: {
type: 'number',
min: 0,
diff --git a/packages/light-leaks/src/LightLeak.tsx b/packages/light-leaks/src/LightLeak.tsx
index 50859db2e9..a3dcaa921a 100644
--- a/packages/light-leaks/src/LightLeak.tsx
+++ b/packages/light-leaks/src/LightLeak.tsx
@@ -236,6 +236,7 @@ const LightLeakCanvas: React.FC<{
const lightLeakSchema = {
durationInFrames: Internals.durationInFramesField,
from: Internals.fromField,
+ freeze: Internals.freezeField,
seed: {
type: 'number',
default: 0,
diff --git a/packages/media/src/audio/audio.tsx b/packages/media/src/audio/audio.tsx
index b25eea186e..0e111f6b11 100644
--- a/packages/media/src/audio/audio.tsx
+++ b/packages/media/src/audio/audio.tsx
@@ -15,6 +15,9 @@ import type {AudioProps} from './props';
const {validateMediaProps} = Internals;
const audioSchema = {
+ durationInFrames: Internals.durationInFramesField,
+ from: Internals.fromField,
+ freeze: Internals.freezeField,
volume: {
type: 'number',
min: 0,
@@ -51,6 +54,7 @@ const AudioInner: React.FC<
_experimentalControls: controls,
from,
durationInFrames,
+ freeze,
hidden,
...otherProps
} = props;
@@ -135,6 +139,7 @@ const AudioInner: React.FC<
layout="none"
from={from ?? 0}
durationInFrames={basicInfo.duration}
+ freeze={freeze}
_remotionInternalStack={stack}
_remotionInternalIsMedia={isMedia}
name={name ?? '<Audio>'}
diff --git a/packages/media/src/audio/props.ts b/packages/media/src/audio/props.ts
index 04547c832c..644dc21806 100644
--- a/packages/media/src/audio/props.ts
+++ b/packages/media/src/audio/props.ts
@@ -47,5 +47,5 @@ export type AudioProps = {
requestInit?: MediaRequestInit;
} & Pick<
SequenceProps,
- 'from' | 'durationInFrames' | 'name' | 'showInTimeline' | 'hidden'
+ 'from' | 'durationInFrames' | 'freeze' | 'name' | 'showInTimeline' | 'hidden'
>;
diff --git a/packages/media/src/video/props.ts b/packages/media/src/video/props.ts
index 44b8554036..0577290237 100644
--- a/packages/media/src/video/props.ts
+++ b/packages/media/src/video/props.ts
@@ -102,5 +102,10 @@ export type VideoProps = MandatoryVideoProps &
NativeVideoProps &
Pick<
SequenceProps,
- 'durationInFrames' | 'from' | 'name' | 'showInTimeline' | 'hidden'
+ | 'durationInFrames'
+ | 'from'
+ | 'freeze'
+ | 'name'
+ | 'showInTimeline'
+ | 'hidden'
>;
diff --git a/packages/media/src/video/video.tsx b/packages/media/src/video/video.tsx
index c509012d78..d571fdfb62 100644
--- a/packages/media/src/video/video.tsx
+++ b/packages/media/src/video/video.tsx
@@ -16,6 +16,9 @@ const {validateMediaTrimProps, resolveTrimProps, validateMediaProps} =
Internals;
const videoSchema = {
+ durationInFrames: Internals.durationInFramesField,
+ from: Internals.fromField,
+ freeze: Internals.freezeField,
volume: {
type: 'number',
min: 0,
@@ -220,6 +223,7 @@ const VideoInner: React.FC<
effects,
durationInFrames,
from,
+ freeze,
hidden,
...props
}) => {
@@ -299,6 +303,7 @@ const VideoInner: React.FC<
layout="none"
from={from ?? 0}
durationInFrames={basicInfo.duration}
+ freeze={freeze}
_remotionInternalStack={stack}
_remotionInternalIsMedia={isMedia}
name={name ?? '<Video>'}
diff --git a/packages/rive/src/RemotionRiveCanvas.tsx b/packages/rive/src/RemotionRiveCanvas.tsx
index 8b1e3a4004..28f0c2d4ca 100644
--- a/packages/rive/src/RemotionRiveCanvas.tsx
+++ b/packages/rive/src/RemotionRiveCanvas.tsx
@@ -37,6 +37,7 @@ import {mapToAlignment, mapToFit} from './map-enums.js';
const {
addSequenceStackTraces,
durationInFramesField,
+ freezeField,
fromField,
hiddenField,
runEffectChain,
@@ -52,7 +53,7 @@ type onLoadCallback = (file: File) => void;
type RiveSequenceInheritedProps = Pick<
SequenceProps,
- 'durationInFrames' | 'name' | 'from' | 'showInTimeline' | 'hidden'
+ 'durationInFrames' | 'name' | 'from' | 'freeze' | 'showInTimeline' | 'hidden'
>;
type RemotionRiveCanvasOwnProps = {
@@ -107,6 +108,7 @@ const riveAlignmentVariants: Record<
const riveCanvasSchema = {
durationInFrames: durationInFramesField,
from: fromField,
+ freeze: freezeField,
fit: {
type: 'enum',
default: 'contain',
@@ -445,6 +447,7 @@ const RemotionRiveCanvasInnerForwardRefFunction: React.ForwardRefRenderFunction<
durationInFrames,
name,
from,
+ freeze,
showInTimeline,
hidden,
...props
@@ -459,6 +462,7 @@ const RemotionRiveCanvasInnerForwardRefFunction: React.ForwardRefRenderFunction<
<Sequence
layout="none"
from={from}
+ freeze={freeze}
hidden={hidden}
showInTimeline={showInTimeline}
name={name ?? '<RemotionRiveCanvas>'}
diff --git a/packages/shapes/src/components/render-svg.tsx b/packages/shapes/src/components/render-svg.tsx
index d9ec1f7f6e..02ed9c6cfb 100644
--- a/packages/shapes/src/components/render-svg.tsx
+++ b/packages/shapes/src/components/render-svg.tsx
@@ -14,7 +14,7 @@ import {doesReactSupportTransformOriginProperty} from '../utils/does-react-suppo
type ShapeSequenceProps = Pick<
SequenceProps,
- 'durationInFrames' | 'from' | 'hidden' | 'name' | 'showInTimeline'
+ 'durationInFrames' | 'from' | 'freeze' | 'hidden' | 'name' | 'showInTimeline'
> & {
readonly _experimentalControls?: SequenceControls;
};
@@ -49,6 +49,7 @@ export const RenderSvg = ({
pixelDensity,
durationInFrames,
from,
+ freeze,
hidden,
name,
showInTimeline,
@@ -212,6 +213,7 @@ export const RenderSvg = ({
<Sequence
layout="none"
from={from}
+ freeze={freeze}
hidden={hidden}
showInTimeline={showInTimeline}
_experimentalControls={controls}
diff --git a/packages/shapes/src/components/schema.ts b/packages/shapes/src/components/schema.ts
index 791d0b5a9a..806e60d4b7 100644
--- a/packages/shapes/src/components/schema.ts
+++ b/packages/shapes/src/components/schema.ts
@@ -82,6 +82,7 @@ export const makeShapeSchema = (
): SequenceSchema => {
return {
from: Internals.sequenceSchema.from,
+ freeze: Internals.sequenceSchema.freeze,
durationInFrames: Internals.sequenceSchema.durationInFrames,
...shapeFields,
fill: colorField({
diff --git a/packages/starburst/src/Starburst.tsx b/packages/starburst/src/Starburst.tsx
index f2c9e4511d..4b0d573ccf 100644
--- a/packages/starburst/src/Starburst.tsx
+++ b/packages/starburst/src/Starburst.tsx
@@ -277,6 +277,7 @@ const StarburstCanvas: React.FC<{
export const starburstSchema = {
durationInFrames: Internals.durationInFramesField,
from: Internals.fromField,
+ freeze: Internals.freezeField,
rays: {
type: 'number',
min: 2,