Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Fix seek() API and don't bundle zod

Jonny Burgere2b4fca3474c
diff --git a/packages/core/src/EditorProps.tsx b/packages/core/src/EditorProps.tsx
index 0ae8da11e4..f96ffa746f 100644
--- a/packages/core/src/EditorProps.tsx
+++ b/packages/core/src/EditorProps.tsx
@@ -35,6 +35,11 @@ export const editorPropsProviderRef = React.createRef<{
setProps: React.Dispatch<React.SetStateAction<Props>>;
}>();
+export const timeValueRef = React.createRef<{
+ goToFrame: () => void;
+ seek: (newFrame: number) => void;
+}>();
+
export const EditorPropsProvider: React.FC<{
readonly children: React.ReactNode;
}> = ({children}) => {
diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.ts
index 9c3fc98a0f..f096cb9d6d 100644
--- a/packages/core/src/internals.ts
+++ b/packages/core/src/internals.ts
@@ -23,6 +23,7 @@ import {
EditorPropsContext,
EditorPropsProvider,
editorPropsProviderRef,
+ timeValueRef,
} from './EditorProps.js';
import {
addSequenceStackTraces,
@@ -168,6 +169,7 @@ export const Internals = {
LogLevelContext,
useLogLevel,
playbackLogging,
+ timeValueRef,
} as const;
export type {
diff --git a/packages/studio/bundle.ts b/packages/studio/bundle.ts
index db95201755..9eaff60781 100644
--- a/packages/studio/bundle.ts
+++ b/packages/studio/bundle.ts
@@ -7,7 +7,13 @@ if (process.env.NODE_ENV !== 'production') {
const mainModule = await build({
entrypoints: ['src/index.ts'],
naming: '[name].mjs',
- external: ['react', 'remotion', 'remotion/no-react', 'react/jsx-runtime'],
+ external: [
+ 'react',
+ 'remotion',
+ 'remotion/no-react',
+ 'react/jsx-runtime',
+ 'zod',
+ ],
});
const [file] = mainModule.outputs;
diff --git a/packages/studio/src/api/seek.ts b/packages/studio/src/api/seek.ts
index 928e24ff0f..840e8f0166 100644
--- a/packages/studio/src/api/seek.ts
+++ b/packages/studio/src/api/seek.ts
@@ -3,8 +3,8 @@
* @see [Documentation](https://www.remotion.dev/docs/studio/seek)
*/
-import {timeValueRef} from '../components/TimeValue';
+import {Internals} from 'remotion';
export const seek = (frame: number) => {
- timeValueRef.current?.seek(Math.max(0, frame));
+ Internals.timeValueRef.current?.seek(Math.max(0, frame));
};
diff --git a/packages/studio/src/components/TimeValue.tsx b/packages/studio/src/components/TimeValue.tsx
index 675850f356..cb73f4eaa1 100644
--- a/packages/studio/src/components/TimeValue.tsx
+++ b/packages/studio/src/components/TimeValue.tsx
@@ -41,11 +41,6 @@ const frameStyle: React.CSSProperties = {
paddingRight: 10,
};
-export const timeValueRef = React.createRef<{
- goToFrame: () => void;
- seek: (newFrame: number) => void;
-}>();
-
export const TimeValue: React.FC = () => {
const frame = useCurrentFrame();
const config = Internals.useUnsafeVideoConfig();
@@ -68,7 +63,7 @@ export const TimeValue: React.FC = () => {
);
useImperativeHandle(
- timeValueRef,
+ Internals.timeValueRef,
() => ({
goToFrame: () => {
ref.current?.click();