-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
57 lines (49 loc) · 1.71 KB
/
scripts.js
File metadata and controls
57 lines (49 loc) · 1.71 KB
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
52
53
54
55
56
57
import uitoolkit from './@zoom/videosdk-ui-toolkit/index.js'
var sessionContainer = document.getElementById('sessionContainer')
var authEndpoint = 'https://or116ttpz8.execute-api.us-west-1.amazonaws.com/default/videosdk'
var config = {
videoSDKJWT: '',
sessionName: 'test',
userName: 'JavaScript',
sessionPasscode: '123',
features: ['preview', 'video', 'audio', 'share', 'chat', 'users', 'settings'],
options: { init: {}, audio: {}, video: {}, share: {}},
virtualBackground: {
allowVirtualBackground: true,
allowVirtualBackgroundUpload: true,
virtualBackgrounds: ['https://images.unsplash.com/photo-1715490187538-30a365fa05bd?q=80&w=1945&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D']
}
};
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'
})