Window undefined with 1.8.5

Description
Getting window is not defined error when trying to integrate web SDK
Error
ReferenceError: window is not defined
at Object. (…/node_modules/@zoomus/websdk/dist/zoomus-websdk.umd.min.js:2:504)

Which version?
1.8.5

Additional context

      export const Zoom = () => {
      useEffect(() => {
    ZoomMtg.setZoomJSLib("https://source.zoom.us/1.8.5/lib", "/av");
    ZoomMtg.preLoadWasm();
    ZoomMtg.prepareJssdk();
    ZoomMtg.generateSignature({
      meetingNumber: zoomConfig.meetingNumber,
      apiKey: zoomConfig.apiKey,
      apiSecret: zoomConfig.apiSecret,

  role: zoomConfig.role,
  success: function (res) {
    setTimeout(() => {
      joinMeeting(res.result, zoomConfig);
    }, 1000);

    console.log("res", res);
  },
});
  }, []);
  return <>Zoom will be here</>;
};

I added :

 <link type="text/css" rel="stylesheet"href="https://source.zoom.us/1.8.5/css/bootstrap.css"/>

<link type="text/css" rel="stylesheet"href="https://source.zoom.us/1.8.5/css/react-select.css"/>
        
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>    

still not working any ideas where is this coming from ?

Hey @Safwen,

Can you please provide steps to reproduce the issue? I am not seeing this issue when testing on my end.

If you are using React, you can see the Web SDK React Sample App here:

Thanks,
Tommy

Hi @tommy

Thank you for reaching out I really appreciate the effort you’re putting here:
So basically it’s NextJS app and currently I got it to work by doing this:

inside the useEffect of the zoom component:

    useEffect(() => {
      import("@zoomus/websdk").then((module) => {
      const { ZoomMtg } = module;
      ZoomMtg.setZoomJSLib("https://source.zoom.us/1.8.5/lib", "/av");
      ZoomMtg.preLoadWasm();
      ZoomMtg.prepareJssdk();
 ...

Still wondering why a simple import had to be this way
it could be something with the SSR nature of Next but still it doesn’t make lot of sense to me

Also another question :
I notice when I navigate to another route without ( hitting the zoom meeting leave button ) when I click on my join button it throws an error : ’ you need to initiate a meeting ’ which the button does already but it seems it only works upon refreshing
So my question is do I need to clean the meeting manually when navigating to another route?

Hey @Safwen,

Happy to hear you got it sorted out! :slight_smile:

I am not too familiar with Next, so I don’t know the specifics of how imports work.

Hm, after leaving a meeting you should be able to join another one. Make sure the ZoomMtg.init function is being called again. :slight_smile:

Thanks,
Tommy

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.