diff --git a/src/index.tsx b/src/index.tsx index f2a304c..b3a3304 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -68,8 +68,8 @@ function ReactHlsPlayer({ } // Check for Media Source support - if (Hls.isSupported()) { - _initPlayer(); + if (typeof window !== 'undefined') { + Hls.isSupported() && _initPlayer(); } return () => { @@ -80,7 +80,9 @@ function ReactHlsPlayer({ }, [autoPlay, hlsConfig, playerRef, src]); // If Media Source is supported, use HLS.js to play video - if (Hls.isSupported()) return