import { Component , OnInit , Inject } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { DOCUMENT } from '@angular/common' ; import { ZoomMtg } from '@zoomus/websdk' ; ZoomMtg . preLoadWasm ( ) ; ZoomMtg . prepareWebSDK ( ) ; ZoomMtg . i18n . load ( 'en-US' ) ; ZoomMtg . i18n . reload ( 'en-US' ) ; @ Component ( { selector : 'app-root' , templateUrl : './app.component.html' , styleUrls : [ './app.component.css' ] } ) export class AppComponent implements OnInit { signatureEndpoint = '' ; apiKey = '' ; meetingNumber = '123456789' ; role = 0 ; leaveUrl = 'http://localhost:4200' ; userName = 'Angular' ; userEmail = '' ; passWord = '' ; registrantToken = '' ; constructor ( public httpClient , @ Inject ( DOCUMENT ) document ) { } ngOnInit ( ) { } getSignature ( ) { this . httpClient . post ( this . signatureEndpoint , { meetingNumber : this . meetingNumber , role : this . role } ) . toPromise ( ) . then ( ( data ) => { 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' ; ZoomMtg . init ( { leaveUrl : this . leaveUrl , success : ( success ) => { console . log ( success ) ; ZoomMtg . join ( { signature : signature , meetingNumber : this . meetingNumber , userName : this . userName , apiKey : this . apiKey , userEmail : this . userEmail , passWord : this . passWord , tk : this . registrantToken , success : ( success ) => { console . log ( success ) ; } , error : ( error ) => { console . log ( error ) ; } } ) ; } , error : ( error ) => { console . log ( error ) ; } } ) ; } }