/
app.component.ts
85 lines (73 loc) · 1.97 KB
/
app.component.ts
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { Component, OnInit, Inject, NgZone } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DOCUMENT } from '@angular/common';
import { ZoomMtg } from '@zoom/meetingsdk';
ZoomMtg.preLoadWasm();
ZoomMtg.prepareWebSDK();
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
authEndpoint = ''
sdkKey = ''
meetingNumber = '123456789'
passWord = ''
role = 0
userName = 'Angular'
userEmail = ''
registrantToken = ''
zakToken = ''
leaveUrl = 'http://localhost:4200'
constructor(public httpClient: HttpClient, @Inject(DOCUMENT) document, private ngZone: NgZone) {
}
ngOnInit() {
}
getSignature() {
this.httpClient.post(this.authEndpoint, {
meetingNumber: this.meetingNumber,
role: this.role
}).toPromise().then((data: any) => {
if(data.signature) {
console.log(data.signature)
this.startMeeting(data.signature)
} else {
console.log(data)
}
}).catch((error) => {
console.log(error)
})
}
startMeeting(signature) {
document.getElementById('zmmtg-root').style.display = 'block'
this.ngZone.runOutsideAngular(() => {
ZoomMtg.init({
leaveUrl: this.leaveUrl,
patchJsMedia: true,
success: (success) => {
console.log(success)
ZoomMtg.join({
signature: signature,
sdkKey: this.sdkKey,
meetingNumber: this.meetingNumber,
passWord: this.passWord,
userName: this.userName,
userEmail: this.userEmail,
tk: this.registrantToken,
zak: this.zakToken,
success: (success) => {
console.log(success)
},
error: (error) => {
console.log(error)
}
})
},
error: (error) => {
console.log(error)
}
})
})
}
}