Skip to content

🎥 Make videos programmatically with React

Merge branch 'main' into remotion-player

Jonny Burger71d48f88391d
diff --cc packages/cli/tsconfig.json
index 94c464afe0,a050a0c7d7..cd056830bd
--- a/packages/cli/tsconfig.json
+++ b/packages/cli/tsconfig.json
@@@ -9,7 -9,7 +9,8 @@@
"references": [
{"path": "../core"},
{"path": "../bundler"},
- {"path": "../media-utils"},
- {"path": "../renderer"}
+ {"path": "../renderer"},
- {"path": "../player"}
++ {"path": "../player"},
++ {"path": "../media-utils"}
]
}
diff --cc packages/core/src/Composition.tsx
index bb068ac8f9,a8a442bcac..dc932aecd8
--- a/packages/core/src/Composition.tsx
+++ b/packages/core/src/Composition.tsx
@@@ -1,5 -1,6 +1,6 @@@
-import React, {ComponentType, useContext, useEffect, useMemo} from 'react';
+import {ComponentType, useContext, useEffect} from 'react';
import {CompositionManager} from './CompositionManager';
+ import {useNonce} from './nonce';
import {
addStaticComposition,
getIsEvaluation,
@@@ -37,8 -37,20 +38,9 @@@ export const Composition = <T,>(
CompositionManager
);
+ const lazy = useLazyComponent(compProps);
+ const nonce = useNonce();
- const lazy = useMemo(() => {
- if ('lazyComponent' in compProps) {
- return React.lazy(compProps.lazyComponent);
- }
- if ('component' in compProps) {
- return React.lazy(() => Promise.resolve({default: compProps.component}));
- }
- throw new Error("You must pass either 'component' or 'lazyComponent'");
- // @ts-expect-error
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [compProps.lazyComponent, compProps.component]);
-
useEffect(() => {
// Ensure it's a URL safe id
if (!id) {
diff --cc packages/core/src/internals.ts
index ac109e772c,d7f4446e3a..fbe3dbe97e
--- a/packages/core/src/internals.ts
+++ b/packages/core/src/internals.ts
@@@ -1,7 -1,7 +1,9 @@@
+import {CompProps} from './Composition';
import {
CompositionManager,
+ CompositionManagerContext,
+ RenderAssetInfo,
+ TAsset,
TCompMetadata,
TComposition,
TSequence,
@@@ -53,11 -52,8 +54,12 @@@ import * as perf from './perf'
import {getCompositionName, getIsEvaluation, getRoot} from './register-root';
import {RemotionRoot} from './RemotionRoot';
import * as Timeline from './timeline-position-state';
-import {TimelineContextValue} from './timeline-position-state';
+import {
+ SetTimelineContextValue,
+ TimelineContextValue,
+} from './timeline-position-state';
+ import {truthy} from './truthy';
+import {useLazyComponent} from './use-lazy-component';
import {useUnsafeVideoConfig} from './use-unsafe-video-config';
import {useVideo} from './use-video';
@@@ -100,7 -94,10 +100,11 @@@ export const Internals =
validateSelectedPixelFormatAndCodecCombination,
validateFrameRange,
getWebpackCaching,
+ useLazyComponent,
+ truthy,
+ isAudioCodec,
+ INPUT_PROPS_KEY,
+ Logging,
};
export type {
@@@ -109,8 -106,7 +113,10 @@@
TCompMetadata,
TSequence,
WebpackOverrideFn,
+ TAsset,
+ RenderAssetInfo,
TimelineContextValue,
+ SetTimelineContextValue,
+ CompProps,
+ CompositionManagerContext,
};