-
Notifications
You must be signed in to change notification settings - Fork 1
/
scripts.js
51 lines (43 loc) · 1.27 KB
/
scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import uitoolkit from './@zoom/videosdk-ui-toolkit/index.js'
var sessionContainer = document.getElementById('sessionContainer')
var authEndpoint = ''
var config = {
videoSDKJWT: '',
sessionName: 'test',
userName: 'JavaScript',
sessionPasscode: '123',
features: ['video', 'audio', 'settings', 'users', 'chat', 'share']
};
var role = 1
window.getVideoSDKJWT = getVideoSDKJWT
function getVideoSDKJWT() {
document.getElementById('join-flow').style.display = 'none'
fetch(authEndpoint, {
method: 'POST',
body: JSON.stringify({
sessionName: config.sessionName,
role: role,
})
}).then((response) => {
return response.json()
}).then((data) => {
if(data.signature) {
console.log(data.signature)
config.videoSDKJWT = data.signature
joinSession()
} else {
console.log(data)
}
}).catch((error) => {
console.log(error)
})
}
function joinSession() {
uitoolkit.joinSession(sessionContainer, config)
uitoolkit.onSessionClosed(sessionClosed)
}
var sessionClosed = (() => {
console.log('session closed')
uitoolkit.closeSession(sessionContainer)
document.getElementById('join-flow').style.display = 'block'
})