Skip to content

🎥 Make videos programmatically with React

better error message for when calling useVideoConfig outside remotion player

Jonny Burger1b3847b01635
diff --git a/packages/core/src/use-video-config.ts b/packages/core/src/use-video-config.ts
index bc9027cd38..755a668d33 100644
--- a/packages/core/src/use-video-config.ts
+++ b/packages/core/src/use-video-config.ts
@@ -9,6 +9,12 @@ import {VideoConfig} from './video-config';
export const useVideoConfig = (): VideoConfig => {
const videoConfig = useUnsafeVideoConfig();
+ if (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) {
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.'