# Error on sample code for video sdk cdn with pure JS

**URL:** <https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [August 4, 2022, 3:16pm UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652 "2022-08-04T15:16:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![imslee100](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/imslee100/32/40177_2.png) [@imslee100](https://devforum.zoom.us/u/imslee100)\
**Post date:** [August 4, 2022, 3:16pm UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652/1 "2022-08-04T15:16:39Z")

</div>

I’m trying to runnig video sdk sample wih pure JS without Node on PHP.

I’ve found following video sdk cdn from forum, but not sure it is right or not.

// For ZoomVideo

Following is my code and There is an error “Zoomvideo is not defined.”

```auto
// For ZoomVideo
<script src="https://source.zoom.us/2.1.1/zoom-meeting-embedded-2.1.1.min.js"></script>
// For generateSignature
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/8.0.20/jsrsasign-all-min.js"></script>

<script>

function generateSignature(sdkKey, sdkSecret, sessionName, role, sessionKey, userIdentity) {

  const iat = Math.round((new Date().getTime() - 30000) / 1000)
  const exp = iat + 60 * 60 * 2
  const oHeader = { alg: 'HS256', typ: 'JWT' }

  const oPayload = {
    app_key: sdkKey,
    tpc: sessionName,
    role_type: role,
    session_key: sessionKey,
    user_identity: userIdentity,
    iat: iat,
    exp: exp
  }

  const sHeader = JSON.stringify(oHeader)
  const sPayload = JSON.stringify(oPayload)
  const sdkJWT = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, sdkSecret)
  return sdkJWT
}

const client = ZoomVideo.createClient();
client.init('en-US', 'CDN');

token = generateSignature('My sdkKey Here', 'My SdkSecret Here', 'Cool Cars', 1, 'session123', 'user123');
topic = 'Cool Cars'
userName = 'user123';
password = 'session123';

// join
client.join(topic, token, userName, password);

// stream
stream = client.getMediaStream();

</script>
```

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [August 5, 2022, 12:58am UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652/2 "2022-08-05T00:58:56Z")

</div>

Hey @imslee100

Thanks for your feedback.  
The link of the `ZoomVideo` is not correct. It’s linked to the MeetingSDK Web.

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![imslee100](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/imslee100/32/40177_2.png) [@imslee100](https://devforum.zoom.us/u/imslee100)\
**Post date:** [August 5, 2022, 5:40pm UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652/3 "2022-08-05T17:40:56Z")

</div>

Could you please let me know what is the ZoomVideo SDK CDN?  
There is link on Zoom Video Documentation.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 8, 2022, 4:36pm UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652/4 "2022-08-08T16:36:20Z")

</div>

Hey @imslee100 ,

I will private message you about this.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![evgen\_dev](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/evgen_dev/32/41297_2.png) [@evgen\_dev](https://devforum.zoom.us/u/evgen_dev)\
**Post date:** [August 28, 2022, 10:43pm UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652/5 "2022-08-28T22:43:23Z")

</div>

Hi Tommy!  
Could you advise me too?  
Thanks

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 29, 2022, 5:15pm UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652/6 "2022-08-29T17:15:08Z")

</div>

Hey @evgen_dev ,

Just sent you a private message.

-Tommy

---

<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:** [September 29, 2022, 3:15am UTC](https://devforum.zoom.us/t/error-on-sample-code-for-video-sdk-cdn-with-pure-js/73652/7 "2022-09-29T03:15:17Z")

</div>

Closed on September 29, 2022, 3:15am UTC

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