Skip to content

🎥 Make videos programmatically with React

fix bad video config

Jonny Burger1d9756e3a4ad
diff --git a/packages/core/src/use-video-config.ts b/packages/core/src/use-video-config.ts
index a74314b820..4481c3848f 100644
--- a/packages/core/src/use-video-config.ts
+++ b/packages/core/src/use-video-config.ts
@@ -9,13 +9,14 @@ import {VideoConfig} from './video-config';
export const useVideoConfig = (): VideoConfig => {
const videoConfig = useUnsafeVideoConfig();
- if (typeof window !== 'undefined' && window.remotion_isPlayer) {
- throw new Error(
- 'No video config found. You are probably calling useVideoConfig() from outside the component passed to <Player />. See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.'
- );
- }
if (!videoConfig) {
+ if (typeof window !== 'undefined' && window.remotion_isPlayer) {
+ throw new Error(
+ 'No video config found. You are probably calling useVideoConfig() from outside the component passed to <Player />. See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.'
+ );
+ }
+
throw new Error(
'No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.'
);