File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,12 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
4646 const [ player , setPlayer ] = useState < any > ( null ) ;
4747 const searchParams = useSearchParams ( ) ;
4848 const vidUrl = options . sources [ 0 ] . src ;
49- const href = window . location . href ;
50- const courseId = href . split ( '/' ) [ 4 ] ;
49+ let href : string | null = null ;
50+ let courseId : string | null = null ;
51+ if ( typeof window !== 'undefined' ) {
52+ href = window . location . href ;
53+ courseId = href . split ( '/' ) [ 4 ] ;
54+ }
5155
5256 const togglePictureInPicture = async ( ) => {
5357 try {
@@ -478,7 +482,7 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
478482
479483 if ( isYoutubeUrl ( vidUrl ) ) return < YoutubeRenderer url = { vidUrl } /> ;
480484
481- if ( appxVideoId )
485+ if ( appxVideoId && typeof window !== 'undefined' && courseId )
482486 return < AppxVideoPlayer courseId = { courseId } videoId = { appxVideoId } /> ;
483487
484488 return (
You can’t perform that action at this time.
0 commit comments