Skip to content

🎥 Make videos programmatically with React

make useVideoConfig safe

yuta0801919d64930d53
diff --git a/packages/core/src/use-video-config.ts b/packages/core/src/use-video-config.ts
index 2b7d31386d..be95d61ccc 100644
--- a/packages/core/src/use-video-config.ts
+++ b/packages/core/src/use-video-config.ts
@@ -2,5 +2,11 @@ import {useUnsafeVideoConfig} from './use-unsafe-video-config';
import {VideoConfig} from './video-config';
export const useVideoConfig = (): VideoConfig => {
- return useUnsafeVideoConfig() as VideoConfig;
+ const videoConfig = useUnsafeVideoConfig();
+
+ if (!videoConfig) {
+ throw new Error('No video config found');
+ }
+
+ return videoConfig;
};