Skip to content

🎥 Make videos programmatically with React

alright

Jonny Burger74aae689abae
diff --git a/packages/core/src/Composition.tsx b/packages/core/src/Composition.tsx
index c183b2a35d..11bde1371d 100644
--- a/packages/core/src/Composition.tsx
+++ b/packages/core/src/Composition.tsx
@@ -1,18 +1,15 @@
import type {ComponentType} from 'react';
import React, {Suspense, useContext, useEffect} from 'react';
import {createPortal} from 'react-dom';
-import type {AnyZodObject, z} from 'zod';
+import type {z} from 'zod';
+import type {AnyZodObject} from './any-zod-type.js';
import {
CanUseRemotionHooks,
CanUseRemotionHooksProvider,
} from './CanUseRemotionHooks.js';
+import type {Codec} from './codec.js';
import {CompositionSetters} from './CompositionManagerContext.js';
import {FolderContext} from './Folder.js';
-import {
- PROPS_UPDATED_EXTERNALLY,
- useResolvedVideoConfig,
-} from './ResolveCompositionConfig.js';
-import type {Codec} from './codec.js';
import {serializeThenDeserializeInStudio} from './input-props-serialization.js';
import {useIsPlayer} from './is-player.js';
import {Loading} from './loading-indicator.js';
@@ -21,6 +18,10 @@ import {portalNode} from './portal-node.js';
import type {InferProps, PropsIfHasProps} from './props-if-has-props.js';
import type {ProResProfile} from './prores-profile.js';
import type {PixelFormat, VideoImageFormat} from './render-types.js';
+import {
+ PROPS_UPDATED_EXTERNALLY,
+ useResolvedVideoConfig,
+} from './ResolveCompositionConfig.js';
import {useDelayRender} from './use-delay-render.js';
import {useLazyComponent} from './use-lazy-component.js';
import {useRemotionEnvironment} from './use-remotion-environment.js';
diff --git a/packages/core/src/CompositionManager.tsx b/packages/core/src/CompositionManager.tsx
index f32c6a4f99..39e770a424 100644
--- a/packages/core/src/CompositionManager.tsx
+++ b/packages/core/src/CompositionManager.tsx
@@ -1,6 +1,6 @@
import type {ComponentType, LazyExoticComponent} from 'react';
import React from 'react';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from './any-zod-type.js';
import type {CalculateMetadataFunction} from './Composition.js';
import type {DownloadBehavior} from './download-behavior.js';
import type {InferProps, PropsIfHasProps} from './props-if-has-props.js';
diff --git a/packages/core/src/CompositionManagerContext.tsx b/packages/core/src/CompositionManagerContext.tsx
index d8781fbadb..a37cb513b0 100644
--- a/packages/core/src/CompositionManagerContext.tsx
+++ b/packages/core/src/CompositionManagerContext.tsx
@@ -1,6 +1,6 @@
import type React from 'react';
import {createContext} from 'react';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from './any-zod-type.js';
import type {AnyComposition, TComposition} from './CompositionManager.js';
import type {TFolder} from './Folder.js';
import type {VideoConfig} from './video-config.js';
diff --git a/packages/core/src/CompositionManagerProvider.tsx b/packages/core/src/CompositionManagerProvider.tsx
index 4c7bdfb25a..6ca4d395c3 100644
--- a/packages/core/src/CompositionManagerProvider.tsx
+++ b/packages/core/src/CompositionManagerProvider.tsx
@@ -5,7 +5,7 @@ import {
useRef,
useState,
} from 'react';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from './any-zod-type.js';
import type {TComposition} from './CompositionManager';
import {compositionsRef, type AnyComposition} from './CompositionManager';
import type {
diff --git a/packages/core/src/Still.tsx b/packages/core/src/Still.tsx
index d643e2021a..51d855c461 100644
--- a/packages/core/src/Still.tsx
+++ b/packages/core/src/Still.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from './any-zod-type.js';
import type {CompositionProps, StillProps} from './Composition.js';
import {Composition} from './Composition.js';
diff --git a/packages/core/src/any-zod-type.ts b/packages/core/src/any-zod-type.ts
new file mode 100644
index 0000000000..978b721fbe
--- /dev/null
+++ b/packages/core/src/any-zod-type.ts
@@ -0,0 +1,4 @@
+import type * as z3 from 'zod/v3';
+import type * as z4 from 'zod/v4/core';
+
+export type AnyZodObject = z3.AnyZodObject | z4.$ZodObject;
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index be1e55584e..328231365b 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -172,6 +172,7 @@ export {Series} from './series/index.js';
export * from './spring/index.js';
export {staticFile} from './static-file.js';
export * from './Still.js';
+export type {AnyZodObject} from './any-zod-type.js';
export type {PlayableMediaTag} from './timeline-position-state.js';
export {useBufferState} from './use-buffer-state';
export {useCurrentFrame} from './use-current-frame.js';
diff --git a/packages/core/src/props-if-has-props.ts b/packages/core/src/props-if-has-props.ts
index eec1c3335e..211a9e0fcc 100644
--- a/packages/core/src/props-if-has-props.ts
+++ b/packages/core/src/props-if-has-props.ts
@@ -1,4 +1,4 @@
-import type {AnyZodObject, z} from 'zod';
+import type {AnyZodObject} from './any-zod-type.js';
type And<A extends boolean, B extends boolean> = A extends true
? B extends true
@@ -34,6 +34,6 @@ export type InferProps<
Props
: {} extends Props
? // Only schema specified
- z.input<Schema>
+ Record<string, unknown>
: // Props and schema specified
- z.input<Schema> & Props;
+ Record<string, unknown> & Props;
diff --git a/packages/core/src/resolve-video-config.ts b/packages/core/src/resolve-video-config.ts
index e2fc474e71..9a7856a8d2 100644
--- a/packages/core/src/resolve-video-config.ts
+++ b/packages/core/src/resolve-video-config.ts
@@ -1,4 +1,4 @@
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from './any-zod-type.js';
import type {
CalcMetadataReturnType,
CalculateMetadataFunction,
diff --git a/packages/player/src/Player.tsx b/packages/player/src/Player.tsx
index 67661b6338..18c58faad7 100644
--- a/packages/player/src/Player.tsx
+++ b/packages/player/src/Player.tsx
@@ -16,7 +16,7 @@ import type {
TimelineContextValue,
} from 'remotion';
import {Composition, Internals} from 'remotion';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from 'remotion';
import {PlayerEmitterProvider} from './EmitterProvider.js';
import type {RenderMuteButton} from './MediaVolumeSlider.js';
import type {
diff --git a/packages/player/src/Thumbnail.tsx b/packages/player/src/Thumbnail.tsx
index 22cb0d721a..296cf9a269 100644
--- a/packages/player/src/Thumbnail.tsx
+++ b/packages/player/src/Thumbnail.tsx
@@ -14,7 +14,7 @@ import {
} from 'react';
import type {CompProps, LogLevel, TimelineContextValue} from 'remotion';
import {Internals, random} from 'remotion';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from 'remotion';
import {ThumbnailEmitterContext} from './emitter-context.js';
import {ThumbnailEmitter} from './event-emitter.js';
import type {ThumbnailMethods} from './player-methods.js';
diff --git a/packages/player/src/utils/props-if-has-props.ts b/packages/player/src/utils/props-if-has-props.ts
index 1431a9172c..1fe5641cdb 100644
--- a/packages/player/src/utils/props-if-has-props.ts
+++ b/packages/player/src/utils/props-if-has-props.ts
@@ -1,4 +1,4 @@
-import type {AnyZodObject, z} from 'zod';
+import type {AnyZodObject} from 'remotion';
export type PropsIfHasProps<
Schema extends AnyZodObject,
@@ -7,7 +7,7 @@ export type PropsIfHasProps<
? {} extends Props
? {
// Neither props nor schema specified
- inputProps?: z.input<Schema> & Props;
+ inputProps?: Record<string, unknown> & Props;
}
: {
// Only props specified
@@ -16,9 +16,9 @@ export type PropsIfHasProps<
: {} extends Props
? {
// Only schema specified
- inputProps: z.input<Schema>;
+ inputProps: Record<string, unknown>;
}
: {
// Props and schema specified
- inputProps: z.input<Schema> & Props;
+ inputProps: Record<string, unknown> & Props;
};
diff --git a/packages/studio/src/api/create-composition.tsx b/packages/studio/src/api/create-composition.tsx
index 4c50a684a5..dec8c1db3a 100644
--- a/packages/studio/src/api/create-composition.tsx
+++ b/packages/studio/src/api/create-composition.tsx
@@ -1,6 +1,6 @@
import type {CompositionProps, StillProps} from 'remotion';
import {Composition, Still} from 'remotion';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from 'remotion';
export const createComposition =
<Schema extends AnyZodObject, Props extends Record<string, unknown>>({
diff --git a/packages/studio/src/api/helpers/calc-new-props.ts b/packages/studio/src/api/helpers/calc-new-props.ts
index 2df7d8c5b4..93cfd40fa2 100644
--- a/packages/studio/src/api/helpers/calc-new-props.ts
+++ b/packages/studio/src/api/helpers/calc-new-props.ts
@@ -1,6 +1,6 @@
import type {_InternalTypes} from 'remotion';
import {Internals, getRemotionEnvironment} from 'remotion';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from 'remotion';
export type UpdateDefaultPropsFunction = (currentValues: {
schema: AnyZodObject | null;
diff --git a/packages/web-renderer/src/create-scaffold.tsx b/packages/web-renderer/src/create-scaffold.tsx
index 130a8487a9..a1320a5d22 100644
--- a/packages/web-renderer/src/create-scaffold.tsx
+++ b/packages/web-renderer/src/create-scaffold.tsx
@@ -3,7 +3,7 @@ import {flushSync} from 'react-dom';
import ReactDOM from 'react-dom/client';
import type {Codec, DelayRenderScope, LogLevel, TRenderAsset} from 'remotion';
import {Internals} from 'remotion';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from 'remotion';
import type {TimeUpdaterRef} from './update-time';
import {UpdateTime} from './update-time';
diff --git a/packages/web-renderer/src/props-if-has-props.ts b/packages/web-renderer/src/props-if-has-props.ts
index 370eaf9932..bfca486bbc 100644
--- a/packages/web-renderer/src/props-if-has-props.ts
+++ b/packages/web-renderer/src/props-if-has-props.ts
@@ -1,6 +1,6 @@
import type {ComponentType} from 'react';
import type {CalculateMetadataFunction} from 'remotion';
-import type {AnyZodObject, z} from 'zod';
+import type {AnyZodObject} from 'remotion';
export type InferProps<
Schema extends AnyZodObject,
@@ -13,9 +13,9 @@ export type InferProps<
Props
: {} extends Props
? // Only schema specified
- z.input<Schema>
+ Record<string, unknown>
: // Props and schema specified
- z.input<Schema> & Props;
+ Record<string, unknown> & Props;
export type DefaultPropsIfHasProps<
Schema extends AnyZodObject,
@@ -24,7 +24,7 @@ export type DefaultPropsIfHasProps<
? {} extends Props
? {
// Neither props nor schema specified
- defaultProps?: z.input<Schema> & Props;
+ defaultProps?: Record<string, unknown> & Props;
}
: {
// Only props specified
@@ -33,11 +33,11 @@ export type DefaultPropsIfHasProps<
: {} extends Props
? {
// Only schema specified
- defaultProps: z.input<Schema>;
+ defaultProps: Record<string, unknown>;
}
: {
// Props and schema specified
- defaultProps: z.input<Schema> & Props;
+ defaultProps: Record<string, unknown> & Props;
};
type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
diff --git a/packages/web-renderer/src/render-media-on-web.tsx b/packages/web-renderer/src/render-media-on-web.tsx
index e34b7f920a..e139aa3286 100644
--- a/packages/web-renderer/src/render-media-on-web.tsx
+++ b/packages/web-renderer/src/render-media-on-web.tsx
@@ -2,7 +2,7 @@ import {BufferTarget, StreamTarget} from 'mediabunny';
import type {CalculateMetadataFunction} from 'remotion';
import {Internals, type LogLevel} from 'remotion';
import {VERSION} from 'remotion/version';
-import type {AnyZodObject, z} from 'zod';
+import type {AnyZodObject} from 'remotion';
import {addAudioSample, addVideoSampleAndCloseFrame} from './add-sample';
import {handleArtifacts, type WebRendererOnArtifact} from './artifact';
import {onlyInlineAudio} from './audio';
@@ -53,7 +53,7 @@ export type InputPropsIfHasProps<
? {} extends Props
? {
// Neither props nor schema specified
- inputProps?: z.input<Schema> & Props;
+ inputProps?: Record<string, unknown> & Props;
}
: {
// Only props specified
@@ -62,11 +62,11 @@ export type InputPropsIfHasProps<
: {} extends Props
? {
// Only schema specified
- inputProps: z.input<Schema>;
+ inputProps: Record<string, unknown>;
}
: {
// Props and schema specified
- inputProps: z.input<Schema> & Props;
+ inputProps: Record<string, unknown> & Props;
};
type MandatoryRenderMediaOnWebOptions<
diff --git a/packages/web-renderer/src/render-still-on-web.tsx b/packages/web-renderer/src/render-still-on-web.tsx
index e969c632b8..413098a813 100644
--- a/packages/web-renderer/src/render-still-on-web.tsx
+++ b/packages/web-renderer/src/render-still-on-web.tsx
@@ -3,7 +3,7 @@ import {
type CalculateMetadataFunction,
type LogLevel,
} from 'remotion';
-import type {AnyZodObject} from 'zod';
+import type {AnyZodObject} from 'remotion';
import type {WebRendererOnArtifact} from './artifact';
import {handleArtifacts} from './artifact';
import {checkForError, createScaffold} from './create-scaffold';