Skip to content

🎥 Make videos programmatically with React

handle window being undefined

Jonny Burgerfa112597927c
diff --git a/packages/core/src/video/get-current-time.ts b/packages/core/src/video/get-current-time.ts
index fffcecfbea..1f6dc03ad2 100644
--- a/packages/core/src/video/get-current-time.ts
+++ b/packages/core/src/video/get-current-time.ts
@@ -39,7 +39,9 @@ export const getMediaTime = ({
startFrom,
});
- const isChrome = window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
+ const isChrome =
+ typeof window !== 'undefined' &&
+ window.navigator.userAgent.match(/Chrome\/([0-9]+)/);
if (
isChrome &&
Number(isChrome[1]) < 112 &&