# Video SDK CDN Pure JS JsMediaSDK\_Instance is not defined

**URL:** <https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [January 30, 2023, 11:05am UTC](https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325 "2023-01-30T11:05:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![imran](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@imran](https://devforum.zoom.us/u/imran)\
**Post date:** [January 30, 2023, 11:05am UTC](https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325/1 "2023-01-30T11:05:31Z")

</div>

Hi there!  
I am implementing Video SDK in Web with pure JS and following the below link:  
[https://marketplace.zoom.us/docs/sdk/video/web/get-started/](https://marketplace.zoom.us/docs/sdk/video/web/get-started/)

First I have included script file:

```auto
<script src="https://source.zoom.us/videosdk/zoom-video-1.6.0.min.js"></script>

```

after that:

```auto
const ZoomVideo = window.WebVideoSDK.default;
const client = ZoomVideo.createClient();
let stream;

```

after this I am generating the signature and than I try to start the session as:

```auto
client.join(topic, token, userName, password).then(() => {
  stream = client.getMediaStream()
}).catch((error) => {
  console.log(error)
})

```

in above lines I get 2 error messages in browser console as:

```auto
Uncaught ReferenceError: JsMediaSDK_Instance is not defined
    at Gi.init (zoom-video-1.5.0.min.js:1:117627)
    at zoom-video-1.5.0.min.js:1:192413
    at t.project (zoom-video-1.5.0.min.js:1:167985)
    at t._next (zoom-video-1.5.0.min.js:1:43999)
    at t.next (zoom-video-1.5.0.min.js:1:5497)
    at t._next (zoom-video-1.5.0.min.js:1:48398)
    at t.next (zoom-video-1.5.0.min.js:1:5497)
    at t._next (zoom-video-1.5.0.min.js:1:31848)
    at t.next (zoom-video-1.5.0.min.js:1:5497)
    at t._next (zoom-video-1.5.0.min.js:1:31848)

```

and 2nd one as:

```auto
Uncaught TypeError: Cannot read properties of undefined (reading 'userRole')
    at t.project (zoom-video-1.5.0.min.js:1:286143)
    at t._tryNext (zoom-video-1.5.0.min.js:1:27759)
    at t._next (zoom-video-1.5.0.min.js:1:27661)
    at t.next (zoom-video-1.5.0.min.js:1:5497)
    at t._next (zoom-video-1.5.0.min.js:1:31848)
    at t.next (zoom-video-1.5.0.min.js:1:5497)
    at t._next (zoom-video-1.5.0.min.js:1:48398)
    at t.next (zoom-video-1.5.0.min.js:1:5497)
    at t._next (zoom-video-1.5.0.min.js:1:31848)
    at t.next (zoom-video-1.5.0.min.js:1:5497)

```

Is there any other script reference that I need to include along, any advise on it is highly appreciated.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [January 30, 2023, 2:58pm UTC](https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325/2 "2023-01-30T14:58:19Z")

</div>

```auto
const ZoomVideo = window.WebVideoSDK.default;
const client = ZoomVideo.createClient();
let stream;

```

after that try to do

```auto
client.init('US-en','CDN')

```

after that, generate your token  
and do

```auto
client.join(topic, token, userName, password).then(() => {
  stream = client.getMediaStream()
}).catch((error) => {
  console.log(error)
})

```

let me know if this helps

---

<div class="post-metadata">

**Author:** ![imran](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@imran](https://devforum.zoom.us/u/imran)\
**Post date:** [January 31, 2023, 8:54am UTC](https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325/3 "2023-01-31T08:54:55Z")

</div>

Thanks for your reply, I was already doing that, however I was doing it like:

```auto
client.init('en-US', 'CDN')

```

instead of

```auto
client.init('US-en','CDN')

```

I changed to what you suggested but still no hope.

---

<div class="post-metadata">

**Author:** ![imran](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@imran](https://devforum.zoom.us/u/imran)\
**Post date:** [January 31, 2023, 9:07am UTC](https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325/4 "2023-01-31T09:07:21Z")

</div>

By the way another error also shows up before these errors as:

```auto
zoom-video-1.5.0.min.js:1 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'append')
    at zoom-video-1.5.0.min.js:1:325862
    at zoom-video-1.5.0.min.js:1:325976
    at new Promise (<anonymous>)
    at yg.init (zoom-video-1.5.0.min.js:1:325525)
    at e.value (zoom-video-1.5.0.min.js:1:490021)
    at index.html:34:11

```

and in index.html 34:11 points to

```auto
client.init('en-US', 'CDN')

```

---

<div class="post-metadata">

**Author:** ![imran](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@imran](https://devforum.zoom.us/u/imran)\
**Post date:** [January 31, 2023, 9:33am UTC](https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325/5 "2023-01-31T09:33:25Z")

</div>

I got it resolved by moving my javascript code in the footer of the page, so either moving code to footer or in document ready or onload function it works.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [March 2, 2023, 7:33pm UTC](https://devforum.zoom.us/t/video-sdk-cdn-pure-js-jsmediasdk-instance-is-not-defined/82325/6 "2023-03-02T19:33:32Z")

</div>

Closed on March 2, 2023, 7:33pm UTC

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