forked from zoom/meetingsdk-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathembedded.d.ts
612 lines (607 loc) · 15.8 KB
/
embedded.d.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
/**
* Define error types of operations.
* - INVALID_OPERATION: The operation is invalid, perhaps causeed by the duplicated operations.
* - INTERNAL_ERROR: The remote service is temporarily unavailable.
* - INSUFFICIENT_PRIVILEGES: The operation is only applicable for host or co-host.
* - OPERATION_TIMEOUT: The operation is timeout, try again later.
* - IMPROPER_MEETING_STATE: The user is not in meeting, refer to the relevant reason for the detail.
* - `closed`: The meeting is not joined.
* - `on hold`: You are on hold.
* - `reconnecting`: The meeting is reconnecting.
* - INVALID_PARAMETERS: The parameters passing to the method is invala, perhaps the wrong user id or the wrong value, refer to the relevant reason for the detail.
* - OPERATION_LOCKED: The operation can not be completed because the relevant property is locked, refer to the relevant reason for the detail.
*/
export type ErrorTypes =
| 'INVALID_OPERATION'
| 'INTERNAL_ERROR'
| 'OPERATION_TIMEOUT'
| 'INSUFFICIENT_PRIVILEGES'
| 'IMPROPER_MEETING_STATE'
| 'INVALID_PARAMETERS'
| 'OPRATION_LOCKED';
export interface ExecutedFailure {
type: ErrorTypes;
reason: string;
}
/**
* Interface for the result of check system requirements.
* > if `audio` is `false`, it means the system cannot support voip, but you can join the audio by phone.
*/
export interface MediaCompatiblity {
/**
*/
audio: boolean;
/**
*/
video: boolean;
/**
*/
screen: boolean;
}
/**
* The result of asynchronous operation. It is a promise object.
* - '': Success
* - ExecutedFailure: Failure. Use `.catch(error=>{})` or `try{ *your code* }catch(error){}` to handle the errors.
*/
export type ExecutedResult = Promise<string | ExecutedFailure>;
/**
* Interface of recording information
*/
export interface RecordingInfo {
/**
* User's custom disclaimer info, if set
*/
recordingDisclaimer: Record<string, any>;
/**
* User's custom disclaimer info to show when initiating the recording, if set
*/
recordingDisclaimerForRecorder: Record<string, any>;
/**
* Attribute for if the user enabled recording reminder
*/
isUserEnableRecordingReminder: boolean;
}
/**
* Interface of a participant
*/
export interface Participant {
/**
* Identify of a user
*/
userId: number;
/**
* Display name of a user.
*/
displayName: string;
/**
* Audio state of a user.
* - `''`: No audio.
* - `computer`: Joined by computer audio.
* - `phone`: Joined by phone
*/
audio: string;
/**
* Whether audio is muted.
*/
muted: boolean;
/**
* Whether the user is host.
*/
isHost: boolean;
/**
* Whether the user is co-host.
*/
isCoHost: boolean;
/**
* Whether the user is guest (not attached to the account )
*/
isGuest: boolean;
/**
* The avatar of a user.
* You can set the avatar in the [web profile](https://zoom.us/profile).
*/
avatar: string;
/**
* Whether the user is phone call user.
*/
isPhoneUser: boolean;
/**
* Whether the user is raised hand.
*/
bRaiseHand: boolean;
/**
* Whether the user is on hold.
*/
bHold: boolean;
/**
* Whether the user is started video.
*/
bVideoOn: boolean;
/**
* Whether the user is started share.
*/
sharerOn: boolean;
/**
* Whether the user is allowed to talk.
* Available in the webinar
*/
isAllowToTalk?: boolean;
/**
* Nonverbal feedback of a user
*/
feedback: number;
/**
* Whether the share is paused
*/
sharePause: boolean;
/**
* User's SDK key, if using one
*/
sdkKey: string;
astAdmin?: boolean;
rmcAdmin?: boolean;
/**
* Whether the participant started recordiing on local computer
*/
bLocalRecord?: boolean;
}
/**
* Interface of meeting information
*/
export interface MeetingInfo {
/**
* meeting number
*/
meetingNumber: number;
/**
* password if it exists
*/
password: string;
/**
* tel password if it exists
*/
telPwd: string;
/**
* user name
*/
userName: string;
/**
* user id
*/
userId: number;
/**
* user email
*/
userEmail: string;
/**
* meeting inviteEmail key
*/
inviteEmail: string;
/**
* user customer key
*/
customerKey: string;
/**
* The topic of meeting
*/
meetingTopic: string;
/**
* The encryption type of the meeting
*/
encryptionType: 'None' | 'AES ECB' | 'AES GCM';
/**
* The server region
*/
region: string;
/**
* The server network
*/
network: string;
/**
* Whether the user is in the meeting
*/
isInMeeting: boolean;
/**
* Language for sdk
*/
lang: string;
/**
* zoom meeting uuid
*/
meetingId: string;
/**
* web endpoint
*/
webEndpoint: string;
/**
* participant id
*/
participantId: number;
/**
* Recording info
*/
recordingInfo: RecordingInfo;
}
/**
* Interface to define a custom button for the Toolbar "More" dropdown menu
*/
export declare interface CustomButton {
/**
* The button's label
*/
text: string;
/**
* Callback when the button's clicked
*/
onClick: Function;
/**
* Classname
*/
className?: string;
}
/** Interface defining custom sizing of components */
export interface CustomSize {
width: number;
height: number;
}
/**
* Arguments and options for joining a meeting
*/
export interface JoinOptions {
/**
* @param sdkKey The Web SDK SDK key.
*/
sdkKey?: string;
/**
* @param signature Generated signature; please see docs for more info https://marketplace.zoom.us/docs/sdk/native-sdks/auth#generate-the-sdk-jwt
*/
signature: string;
/**
* @param meetingNumber The Zoom Meeting number
*/
meetingNumber: string;
/**
* @param password The Zoom Meeting password
*/
password?: string;
/**
* @param userName The user's name
*/
userName: string;
/**
* @param userEmail The user's email
*/
userEmail?: string;
/**
* @param customerKey
*/
customerKey?: string;
/**
* @param tk Optional 'tk' param to join a webinar with registration
*/
tk?: string;
/**
* @param zak Optional 'zak' param to suppport oath start meeting/webinar
*/
zak?: string;
/**
* @param success join success callback
*/
success?: Function;
/**
* @param error join error callback
*/
error?: Function;
}
export type MeetingInfoType = 'topic' | 'host' | 'mn' | 'pwd' | 'telPwd' | 'invite' | 'participant' | 'dc' | 'enctype';
export type PopperPlacementType =
| 'bottom-end'
| 'bottom-start'
| 'bottom'
| 'left-end'
| 'left-start'
| 'left'
| 'right-end'
| 'right-start'
| 'right'
| 'top-end'
| 'top-start'
| 'top';
export interface PositionStyle {
top?: string | number;
left?: string | number;
right?: string | number;
bottom?: string | number;
}
export interface PopperStyle {
disableDraggable?: boolean;
anchorReference?: 'anchorEl' | 'anchorPosition';
anchorElement?: HTMLElement | null;
anchorPosition?: PositionStyle;
modifiers?: object;
placement?: PopperPlacementType;
}
export type VideoPopperStyle = Omit<PopperStyle, 'anchorElement' | 'modifiers' | 'placement' | 'anchorReference'>;
export interface InitOptions {
debug?: boolean;
/**
* Renders the toolbar and main-panel-view using ReactDOM into the given container
* @param zoomAppRoot The HTML element, typically a <div>, to render the toolbar in
*/
zoomAppRoot: HTMLElement | undefined;
/**
* @param assetPath default 'https://source.zoom.us/{version}/lib/av'
*/
assetPath?: string;
/**
* @param webEndpoint default 'zoom.us'
*/
webEndpoint?: string;
/**
* @param language default 'en-US'
*/
language?: string;
/**
* @param customize optional customization options for the embedded client
*/
customize?: {
/**
* Customization options for the toolbar
* @param buttons custom buttons to add to the toolbar dropdown menu
*/
toolbar?: {
buttons?: Array<CustomButton>;
};
/** Customization options for meeting info attributes */
meetingInfo?: Array<MeetingInfoType>;
/**
* Customize the meeting invite url format (e.g. https://yourdomain/{0}?pwd={1})
* This will not work by default, and you need to set `Enable Client SDK Customize Invite Url`
*/
inviteUrlFormat?: string;
/**
* Customization options for the participants panel
* @param popper options for the underlying popper element
*/
participants?: {
popper?: PopperStyle;
};
/**
* Customization options for the settings panel
* @param popper options for the underlying popper element
*/
setting?: {
popper?: PopperStyle;
};
/**
* Customization options for chat notifications and panel
* @param notificationCls options for chat notifications
* @param popper options for the underlying popper element
*/
chat?: {
notificationCls?: PositionStyle;
popper?: PopperStyle;
};
/**
* Customization options for the meeting info panel
* @param popper options for the underlying popper element
*/
meeting?: {
popper?: PopperStyle;
};
/**
* @param activeApps customization options for the active apps notifier popper position
*/
activeApps?: {
popper?: PopperStyle;
};
/**
* Customization options for the video/suspension view
* @param popper options for the underlying popper element
* @param isResizable whether or not the video view is resizable. Default: true
* @param size sizing options for the ribbon view, and all other views
*/
video?: {
popper?: VideoPopperStyle;
isResizable?: boolean;
viewSizes?: {
ribbon?: CustomSize;
default?: CustomSize;
};
};
};
/**
* Maximum participants displayed per screen in Gallery View, up to 25
*/
maximumVideosInGalleryView?: number;
}
export declare function event_audio_statistic_data_change(payload: {
data: {
avg_loss: number;
encoding: boolean;
jitter: number;
max_loss: number;
rtt: number;
sample_rate: number;
};
type: string;
}): void;
/**
* Occurs when decode (recevied) the video statistics data is changed
* @param payload the event detail
* - `data`
* - `encoding`: if encoding is true, means that the data is encoding video data statisitics.
* - `avg_loss`: average package loss for video
* - `jitter`: jitter for video
* - `max_loss`: max package loss for video
* - `rtt`: round trip time for video .
* - `sample_rate`: sample rate video
* - `width`: width for video
* - `height`: height for video
* - `fps`: fps for video
* - `type` : string VIDEO_QOS_DATA
*
* ```javascript
* client.on('video_statistic_data_change', (payload) => {
* console.log('emit', payload);
* });
* ```
* @event
*/
export declare function event_video_statistic_data_change(payload: {
data: {
avg_loss: number;
encoding: boolean;
jitter: number;
max_loss: number;
rtt: number;
sample_rate: number;
width: number;
height: number;
fps: number;
};
type: string;
}): void;
export declare namespace EmbeddedClient {
/**
* Initializes the M-SDK Components client
* @param args init options
*/
function init(args: InitOptions): ExecutedResult;
/**
* Joins a meeting and renders the client
* @param args join options
*/
function join(args: JoinOptions): ExecutedResult;
/**
* Gets the current user's info
*/
function getCurrentUser(): Participant | null;
/**
* Gets the current meeting's info
*/
function getCurrentMeetingInfo(): MeetingInfo;
/**
* Gets the list of participants
*/
function getAttendeeslist(): Participant[];
/**
* Stop the audio
* - It works only the audio flag is `true` in the media constraints.
*
* Version >= 2.1.1
* @returns executed promise.
*/
function stopAudio(): ExecutedResult;
/**
* Toggles mute
* @param mute true to mute, false to unmute
* @param userId user to toggle mute for
*/
function mute(mute: boolean, userId?: Number): ExecutedResult;
/**
* Mutes all participants
* @param muteAll true to mute, false to unmute
*/
function muteAll(muteAll: boolean): ExecutedResult;
/**
* Renames participant
* @param newName new name
* @param userId user to rename
*/
function rename(newName: string, userId: number): ExecutedResult;
/**
* Admits a participant from the waiting room
* @param userId user to admit
*/
function admit(userId: number): ExecutedResult;
/**
* Admits all participants in waiting room
*/
function admitAll(): ExecutedResult;
/**
* Expels a user from the meeting
* @param userId user to expel
*/
function expel(userId: number): ExecutedResult;
/**
* Starts, stops, or pauses cloud recording
* @param record
*/
function record(record: 'start' | 'pause' | 'stop'): ExecutedResult;
/**
* Locks meeting
* @param lockMeeting true to lock, false to unlock
*/
function lockMeeting(lockMeeting: boolean): ExecutedResult;
/**
* Leaves the meeting. If leaving as a host, a userId of the next host should be passed in as an argument
* @param userId The user ID to assign host to (if leaving as a host)
*/
function leaveMeeting(userId?: number): ExecutedResult;
/**
* Ends the meeting
*/
function endMeeting(): ExecutedResult;
/**
* Toggles if a user is on hold
* @param userId user to toggle hold status for
* @param hold true to put on hold, false to remove from hold
*/
function putOnHold(userId: number, hold: boolean): ExecutedResult;
/**
* Toggles if a webinar attendee can talk
* @param userId user to toggle the talking permission
* @param isAllow true to allow the attendee to talk, false to disable talking
*/
function allowAttendeeToTalk(userId: number, isAllow: boolean): ExecutedResult;
/**
* subscribe statistic qos data
* @param args.audio if true subscribe audio qos
* @param args.video if true subscribe video qos
*/
function subscribeStatisticData(args?: { audio: boolean; video: boolean }): ExecutedResult;
/**
* unsubscribe statistic qos data
* @param args.audio if true unsubscribe audio qos
* @param args.video if true unsubscribe video qos
*/
function unSubscribeStatisticData(args?: { audio: boolean; video: boolean }): ExecutedResult;
/**
* Listen for the events and handle them.
* ```javascript
* on("connection-change", (payload) => {
* if (payload.state === 'Closed) {
* console.log("Meeting ended")
* }
* })
* ```
* @param event event name (For meeting end event, set the event to "connection-change")
* @param callback event handler (event name (For meeting end event, the paylaod of the callback is payload.state === 'Closed')
*/
function on(event: 'connection-change', callback: (payload: any) => void): void;
function on(event: 'audio-statistic-data-change', callback: typeof event_audio_statistic_data_change): void;
function on(event: 'video-statistic-data-change', callback: typeof event_video_statistic_data_change): void;
/**
* Remove the event handler. Must be used with on() in pairs.
* @param event event name
* @param callback event handler
*/
function off(event: string, callback: (payload: any) => void): void;
/**
* Checks the compatibility of the current browser.
* Use this method before calling {@link init} to check if the SDK is compatible with the web browser.
*
* Version >= 2.1.1
* @returns A `MediaCompatiblity` object. The object has following properties:
* - `audio`: boolean, whether the audio is compatible with the current web browser.
* - `video`: boolean, whether the video is compatible with the current web browser.
* - `screen`: boolean, whether the screen is compatible with the current web browser.
*/
function checkSystemRequirements(): MediaCompatiblity;
}
export declare namespace ZoomMtgEmbedded {
const VERSION: string;
function createClient(): typeof EmbeddedClient;
}
export default ZoomMtgEmbedded;