@zoom/videosdk-ui-toolkit 1.8.18 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -44
- package/dist/videosdk-ui-toolkit.css +1 -1
- package/dist/videosdk-ui-toolkit.js +1 -1
- package/index.d.ts +11 -4
- package/index.js +57 -2
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -16,14 +16,19 @@ In your frontend project, install the Video SDK UI toolkit:
|
|
|
16
16
|
$ npm install @zoom/videosdk-ui-toolkit --save
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Or, for Vanilla JS applications, download the package and add it to your project. Then, add the following script and CSS style to the HTML page you want the UI toolkit to live on:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<link rel="stylesheet" href="@zoom/videosdk-ui-toolkit/dist/videosdk-ui-toolkit.css">
|
|
23
|
+
<script src="@zoom/videosdk-ui-toolkit/index.js" type="module"></script>
|
|
24
|
+
```
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
## Setup
|
|
22
27
|
|
|
23
|
-
For webpack / single page applications like Angular, Vue, React, etc,
|
|
28
|
+
For webpack / single page applications like Angular, Vue, React, etc, import the UI toolkit, package and styles:
|
|
24
29
|
|
|
25
30
|
```js
|
|
26
|
-
import
|
|
31
|
+
import uitoolkit from '@zoom/videosdk-ui-toolkit'
|
|
27
32
|
import '@zoom/videosdk-ui-toolkit/dist/videosdk-ui-toolkit.css'
|
|
28
33
|
```
|
|
29
34
|
|
|
@@ -35,89 +40,118 @@ In Angular, CSS can't be imported directly into the component, instead, add the
|
|
|
35
40
|
]
|
|
36
41
|
```
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
Or, for Vanilla JS applications, import the JS file directly:
|
|
39
44
|
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
<script src="videosdk-ui-toolkit.js"></script>
|
|
45
|
+
```js
|
|
46
|
+
import uitoolkit from './@zoom/videosdk-ui-toolkit/index.js'
|
|
43
47
|
```
|
|
44
48
|
|
|
49
|
+
> [JS imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html) work if your script tag has the `type="module"` attribute.
|
|
50
|
+
|
|
51
|
+
> UI toolkit CDN is coming soon to make vanilla JS usage easier.
|
|
52
|
+
|
|
45
53
|
## Usage
|
|
46
54
|
|
|
47
|
-
### Preview
|
|
55
|
+
### Open Preview
|
|
48
56
|
|
|
49
|
-
To preview your
|
|
57
|
+
To open the preview kit, to preview your camera, microphone, and speaker, create an HTML container that it will be render in:
|
|
50
58
|
|
|
51
59
|
```html
|
|
52
|
-
<
|
|
60
|
+
<div id='previewContainer'></div>
|
|
53
61
|
```
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
Then, call the `uitoolkit.openPreview` function, passing in the container reference:
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
```js
|
|
66
|
+
var previewContainer = document.getElementById('previewContainer')
|
|
58
67
|
|
|
59
|
-
|
|
60
|
-
<div id='UIToolkit'></div>
|
|
68
|
+
uitoolkit.openPreview(previewContainer)
|
|
61
69
|
```
|
|
62
70
|
|
|
63
|
-
|
|
71
|
+
### Close Preview
|
|
72
|
+
|
|
73
|
+
To close the preview kit, call the `uitoolkit.closePreview` function:
|
|
64
74
|
|
|
65
75
|
```js
|
|
66
|
-
|
|
76
|
+
uitoolkit.closePreview(previewContainer)
|
|
77
|
+
```
|
|
67
78
|
|
|
68
|
-
|
|
79
|
+
### Join Session
|
|
80
|
+
|
|
81
|
+
To join a Video SDK session, create an HTML container that it will be render in:
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<div id='sessionContainer'></div>
|
|
69
85
|
```
|
|
70
86
|
|
|
71
|
-
|
|
87
|
+
Create your Video SDK session config object, with your [Video SDK JWT](https://developers.zoom.us/docs/video-sdk/auth/), and [Video SDK session info](https://developers.zoom.us/docs/video-sdk/web/sessions/#prerequisites) features you want to render.
|
|
72
88
|
|
|
73
89
|
```js
|
|
74
|
-
|
|
90
|
+
var config = {
|
|
75
91
|
videoSDKJWT: '',
|
|
76
|
-
sessionName: '',
|
|
77
|
-
userName: '',
|
|
78
|
-
sessionPasscode: '',
|
|
92
|
+
sessionName: 'SessionA',
|
|
93
|
+
userName: 'UserA',
|
|
94
|
+
sessionPasscode: 'abc123',
|
|
79
95
|
features: ['video', 'audio', 'settings', 'users', 'chat']
|
|
80
|
-
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
81
98
|
|
|
82
|
-
|
|
99
|
+
Then, call the `uitoolkit.joinSession` function, passing in the container reference, and the Video SDK session config object:
|
|
83
100
|
|
|
84
|
-
|
|
101
|
+
```js
|
|
102
|
+
var sessionContainer = document.getElementById('sessionContainer')
|
|
103
|
+
|
|
104
|
+
uitoolkit.joinSession(sessionContainer, config)
|
|
85
105
|
```
|
|
86
106
|
|
|
87
|
-
### Leave
|
|
107
|
+
### Leave Session
|
|
88
108
|
|
|
89
109
|
To leave a Video SDK session, the user can click the red leave button. The host can also end the session for everyone, by clicking their red end button.
|
|
90
110
|
|
|
91
|
-
You can also leave
|
|
111
|
+
You can also leave a session programatically by calling the `uitoolkit.closeSession` function:
|
|
92
112
|
|
|
93
113
|
```js
|
|
94
|
-
|
|
95
|
-
//or
|
|
96
|
-
window.ZoomUIToolKit.destroy(true); //If you're a host you can end the meeting by passing in 'true'
|
|
114
|
+
uitoolkit.closeSession(sessionContainer)
|
|
97
115
|
```
|
|
98
116
|
|
|
99
|
-
|
|
117
|
+
### Event Listeners
|
|
118
|
+
|
|
119
|
+
To subscribe to event listeners, define a callback function that you want to execute when the respective event is triggered:
|
|
100
120
|
|
|
101
121
|
```js
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})
|
|
122
|
+
var sessionJoined = (() => {
|
|
123
|
+
console.log('session joined')
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
var sessionClosed = (() => {
|
|
127
|
+
console.log('session closed')
|
|
128
|
+
})
|
|
105
129
|
```
|
|
106
130
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
131
|
+
Then, pass the callback function to the respective **on** event listener (after calling the `uitoolkit.joinSession` function).
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
uitoolkit.onSessionJoined(sessionJoined)
|
|
135
|
+
|
|
136
|
+
uitoolkit.onSessionClosed(sessionClosed)
|
|
112
137
|
```
|
|
113
138
|
|
|
114
|
-
|
|
139
|
+
To unsubscribe to event listeners, pass the callback function to the respective **off** event listener.
|
|
140
|
+
|
|
115
141
|
```js
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
142
|
+
uitoolkit.offSessionJoined(sessionJoined)
|
|
143
|
+
|
|
144
|
+
uitoolkit.offSessionClosed(sessionClosed)
|
|
119
145
|
```
|
|
120
146
|
|
|
147
|
+
Currently, we support the following event listeners:
|
|
148
|
+
|
|
149
|
+
| Event Listener | Description |
|
|
150
|
+
| ------------------ | -------------------------------------------------- |
|
|
151
|
+
| `onSessionJoined` | Fires when the user joins the session succesfully. |
|
|
152
|
+
| `onSessionClosed` | Fires when the session is left or ended. |
|
|
153
|
+
| `offSessionJoined` | Unsubscribes to the `onSessionJoined` event. |
|
|
154
|
+
| `offSessionClosed` | Unsubscribes to the `onSessionClosed` event. |
|
|
121
155
|
|
|
122
156
|
## Sample Apps
|
|
123
157
|
|