@xylink/xy-rtc-sdk 2.0.1-beta.9 → 2.0.3-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * WebRTC权限状态
3
+ *
4
+ * @value granted 已授权
5
+ * @value denied 已拒绝
6
+ * @value prompt 询问中
7
+ * @value unknow 未知
8
+ * @value '' 默认
9
+ */
10
+ export declare type TPermissionType = 'granted' | 'denied' | 'prompt' | 'unknow' | 'failed' | '';
11
+ /**
12
+ * 获取设备信息
13
+ *
14
+ * @property { string } deviceId 设备id
15
+ * @property { string } label 设备名称
16
+ * @property { string } groupId 设备分组
17
+ * @property { 'output' | 'input' } direction 设备方向
18
+ * @value output 输出设备
19
+ * @value input 输入设备
20
+ * @property { 'audioinput' | 'audiooutput' | 'videoinput' } kind 设备种类
21
+ * @value audioinput 音频输入
22
+ * @value audiooutput 音频输出
23
+ * @value videoinput 摄像头输入
24
+ * @property { string } type 设备采集流类型:video/audio
25
+ */
26
+ export declare type IDeviceInfo = {
27
+ deviceId: string;
28
+ label: string;
29
+ groupId?: string;
30
+ direction?: 'output' | 'input';
31
+ kind?: 'audioinput' | 'audiooutput' | 'videoinput';
32
+ type?: 'video' | 'audio';
33
+ };
34
+ /**
35
+ * 设备列表:麦克风、扬声器、摄像头
36
+ *
37
+ * @property { IDeviceInfo[] } audioInputList 麦克风列表
38
+ * @property { IDeviceInfo[] } audioOutputList 扬声器列表
39
+ * @property { IDeviceInfo[] } videoInList 摄像头列表
40
+ */
41
+ export declare type IDeviceList = {
42
+ audioInputList: IDeviceInfo[];
43
+ audioOutputList: IDeviceInfo[];
44
+ videoInList: IDeviceInfo[];
45
+ };
46
+ /**
47
+ * 当前已选择设备信息
48
+ *
49
+ * @property { IDeviceInfo | undefined } audioInput 麦克风设备
50
+ * @property { IDeviceInfo | undefined } audioOutput 扬声器设备
51
+ * @property { IDeviceInfo | undefined } videoInput 摄像头设备
52
+ */
53
+ export declare type ISelectedDevice = {
54
+ audioInput: IDeviceInfo | undefined;
55
+ videoInput: IDeviceInfo | undefined;
56
+ audioOutput: IDeviceInfo | undefined;
57
+ };
58
+ /**
59
+ * 设备变化事件
60
+ *
61
+ * @property { ISelectedDevice } nextDevice 最新的设备
62
+ * @property { IDeviceList } detail 最新设备详细信息
63
+ */
64
+ export declare type IDeviceManagerChangeValue = {
65
+ nextDevice: ISelectedDevice;
66
+ detail: IDeviceList;
67
+ };
68
+ /**
69
+ * 当前麦克风/摄像头权限
70
+ *
71
+ * @property { TPermissionType } microphone 麦克风权限
72
+ * @property { TPermissionType } camera 摄像头权限
73
+ */
74
+ export interface ICurrentPermission {
75
+ microphone: TPermissionType;
76
+ camera: TPermissionType;
77
+ }
@@ -1,618 +1,11 @@
1
1
  /**
2
- * Type decelare
3
- * @authors Luo-jinghui (luojinghui424@gmail.com)
2
+ * WebRTC SDK Lib TypeScript Decelare
3
+ *
4
+ * @authors luojinghui (luojinghui424@gmail.com)
5
+ * chengfei (chengfei@xylink.com)
4
6
  * @date 2019-10-23 12:02:33
5
7
  */
6
- import VideoManager from '../main/videoManager';
7
- export declare type IClientLayout = 'AUTO' | 'CUSTOM' | 'auto' | 'custom';
8
- export declare type IDirection = 'recvonly' | 'sendrecv' | 'sendonly' | 'inactive';
9
- export declare type ISahreContentStatus = 'ENDED' | 'STARTING' | 'PENDING';
10
- export declare type IStreamTrackStatus = 'ENABLED' | 'MUTE' | 'ENDED';
11
- export declare type IVideoLoadStatus = 'LOAD_START' | 'CANPLAY' | 'ERROR';
12
- export declare type IVideoManagerState = '' | 'CANPLAY' | 'ENDED' | 'REQUEST';
13
- export declare type Direction = 'recvonly' | 'inactive' | 'sendonly' | 'sendrecv';
14
- export declare type TPermissionType = 'granted' | 'denied' | 'prompt' | '';
15
- export declare type IMode = ITemplateMode | IContentTemplateMode;
16
- export declare type ITemplateMode = 'SPEAKER' | 'GALLERY';
17
- export declare type IContentTemplateMode = 'MULTI_PIC_CONTENT_HIGH_PRIORITY' | 'MULTI_PIC_ACTIVE_HIGH_PRIORITY' | 'TWO_PIC_PIP' | 'CONTENT_ONLY' | 'TWO_PIC_SYMMETRIC';
18
- export declare type TCustomStream = {
19
- kind: 'video' | 'audio';
20
- };
21
- export declare type IClientErrorState = 'NONE' | 'PUBLISH_ERROR' | 'WS_CLOSE' | 'WS_ERROR';
22
- export declare type IPushType = 'ALL' | 'CONTENT';
23
- export declare type IStreamStatus = 'NORMAL' | 'DOMSTRING' | 'INVALID';
24
- export declare type IStreamCurrentType = 'NORMAL' | 'SEND_ONLY' | 'FAILED';
25
- export declare type IStreamObjType = 'contentStream' | 'previewStream' | 'pipelineStream' | 'remoteStream';
26
- export declare type IVideoAudioType = 'muteAudio' | 'muteVideo' | 'unmuteAudio' | 'unmuteVideo';
27
- export declare type IResolutionType = 0 | 1 | 2 | 3 | 4 | 5;
28
- export declare type IQualityType = 0 | 1 | 2;
29
- export declare type IMediaQualityType = 0 | 100 | 200;
30
- export declare type IVideoAudioMessageType = 'AUDIO_MUTE' | 'VIDEO_MUTE' | 'AUDIO_UN_MUTE' | 'VIDEO_UN_MUTE';
31
- export declare type ILayoutState = 'MUTE' | 'REQUEST' | 'NORMAL' | 'INVALID' | 'AUDIO_TEL' | 'AUDIO_ONLY' | 'AUDIO_CONTENT';
32
- declare type IDeviceType = 'webrtc' | 'soft' | 'hard' | 'nemono' | 'virtualnemo' | 'nemo' | 'tvbox' | 'h323' | 'record' | 'bruce' | 'tel' | 'pstngw' | 'desk';
33
- export declare type TStateAction = 'click' | 'msgCallback' | 'server' | 'trigger';
34
- export declare type TEventType = 'callIn' | 'layout' | 'content' | 'audioMute' | 'audioUnmute' | 'voidMute' | 'voidUnmute' | 'udioUnmute' | 'audioMute' | 'subtitle' | string;
35
- export declare type TCommand = 0 | 1 | 2 | 3;
36
- export interface IClientConfig {
37
- wssServer?: string;
38
- httpServer?: string;
39
- logServer?: string;
40
- layout?: IClientLayout;
41
- debug?: boolean;
42
- muteAudio?: boolean;
43
- muteVideo?: boolean;
44
- container?: {
45
- offset?: number[];
46
- elementId?: string;
47
- };
48
- localHide?: boolean;
49
- localMirror?: boolean;
50
- clientId?: string;
51
- templateMode?: ITemplateMode;
52
- __hideId?: string;
53
- __monitorMode?: string;
54
- isThird?: boolean;
55
- }
56
- export interface IGetMediaStreams {
57
- previewStreams: IStreamObj[];
58
- streams: IStreamObj[];
59
- pipelineStreams: IStreamObj[];
60
- contentStreams: IStreamObj[];
61
- }
62
- export interface ILoginExtAccount {
63
- displayName: string;
64
- extId: string;
65
- }
66
- export interface ISdkUserInfo {
67
- userName: string;
68
- password: string;
69
- }
70
- export interface IServers {
71
- wssServer: string;
72
- httpServer: string;
73
- logServer: string;
74
- }
75
- export interface IHttpConfig {
76
- baseUrl: string;
77
- }
78
- export interface IConfig {
79
- client_id: string;
80
- access_token: string;
81
- signSecret: string;
82
- refresh_token?: string;
83
- domain?: string;
84
- expires_in?: string;
85
- openid?: string;
86
- scope?: string;
87
- signType?: any;
88
- token_type?: string;
89
- }
90
- export interface ICall {
91
- token: string;
92
- confNumber: string;
93
- password?: string;
94
- displayName?: string;
95
- }
96
- export interface IInvite {
97
- callerUri: string;
98
- callIndex: number;
99
- automute: string;
100
- meetingId: string;
101
- }
102
- export interface IMeetingControl {
103
- callIndex: number;
104
- callUri: string;
105
- chairmanUri: string;
106
- disableMute: boolean;
107
- muteOperation: string;
108
- role: string;
109
- type: string;
110
- }
111
- export interface IStreamChange {
112
- streamId: string;
113
- resolution: number;
114
- bandwidth: number;
115
- frameRate: number;
116
- }
117
- export interface IStreamChangeType {
118
- type: string;
119
- streamChangeInfo: IStreamChange[];
120
- mediagroupid: number;
121
- }
122
- export interface IStreamChangeListType {
123
- content: IStreamChange[];
124
- people: IStreamChange[];
125
- }
126
- export interface IRoster {
127
- deviceType: IDeviceType;
128
- endpointId: string;
129
- displayName: string;
130
- mediagroupid: number;
131
- participantId: number;
132
- audioTxMute: boolean;
133
- videoTxMute: boolean;
134
- audioRxMute: boolean;
135
- videoRxMute: boolean;
136
- videoMuteReason: number;
137
- isForceFullScreen: boolean;
138
- isLastAdd: boolean;
139
- onHold: boolean;
140
- isPolling: boolean;
141
- isContent: boolean;
142
- isActiveSpeaker?: boolean;
143
- id: string;
144
- isLocal?: boolean;
145
- }
146
- export interface ISelfRoster extends IRoster {
147
- isLocal: boolean;
148
- }
149
- export interface ILayoutRoster {
150
- participantId: number;
151
- mediagroupid: number;
152
- feccOri: number;
153
- remoteType: string;
154
- remoteName: string;
155
- remoteID: string;
156
- videoTrackId: string;
157
- audioTrackId: string;
158
- isAudioMute: boolean;
159
- isVideoMute: boolean;
160
- isActiveSpeaker: boolean;
161
- isContent: boolean;
162
- isChairman: boolean;
163
- LayoutVideoState: number;
164
- MuteReason: number;
165
- calluri?: string;
166
- }
167
- export interface IStream {
168
- bubbles: boolean;
169
- cancelBubble: boolean;
170
- cancelable: boolean;
171
- composed: boolean;
172
- currentTarget: any;
173
- defaultPrevented: boolean;
174
- eventPhase: number;
175
- isTrusted: boolean;
176
- receiver: {
177
- track: MediaStreamTrack;
178
- getContributingSources: any;
179
- getStats: any;
180
- };
181
- returnValue: boolean;
182
- srcElement: RTCPeerConnection;
183
- streams: MediaStream[];
184
- target: RTCPeerConnection;
185
- timeStamp: number;
186
- track: MediaStreamTrack;
187
- transceiver: RTCRtpTransceiver;
188
- type: string;
189
- }
190
- export interface IMediaStream {
191
- active: boolean;
192
- id: string;
193
- onaddtrack: any;
194
- onremovetrack: any;
195
- }
196
- export interface IMediaStreamTrack {
197
- contentHint: string;
198
- enabled: boolean;
199
- id: string;
200
- kind: 'video' | 'audio';
201
- label: string;
202
- muted: boolean;
203
- onended: any;
204
- onmute: any;
205
- onunmute: any;
206
- readyState: string;
207
- }
208
- export interface IRTCTransceiver {
209
- currentDirection: Direction;
210
- direction: Direction;
211
- mid: string;
212
- receiver: RTCRtpReceiver;
213
- sender: RTCRtpSender;
214
- stopped: boolean;
215
- }
216
- export interface ISpeakerInfo {
217
- endpointId: string;
218
- pid: number;
219
- }
220
- export interface ILayout {
221
- position: number[];
222
- resolution: IResolutionType;
223
- roster: IRoster;
224
- rotate: any;
225
- seat: number;
226
- state: ILayoutState;
227
- positionStyle?: {
228
- left: string;
229
- top: string;
230
- width: string;
231
- height: string;
232
- };
233
- positionInfo?: {
234
- width: number;
235
- height: number;
236
- };
237
- deal?: boolean;
238
- zIndex?: number;
239
- }
240
- export interface ICustomLayoutObj {
241
- resolution: IResolutionType;
242
- roster: IRoster;
243
- rotate: any;
244
- state: ILayoutState;
245
- quality: 0 | 100 | 200;
246
- deal?: boolean;
247
- position?: number[];
248
- positionStyle?: {
249
- left?: string;
250
- top?: string;
251
- width?: string;
252
- height?: string;
253
- };
254
- positionInfo?: {
255
- width?: number;
256
- height?: number;
257
- };
258
- zIndex?: number;
259
- }
260
- export interface IReqObject {
261
- resolution: IResolutionType;
262
- quality: IQualityType;
263
- callUri: string;
264
- isContent: boolean;
265
- }
266
- export interface IScreenInfo {
267
- width: number;
268
- height: number;
269
- rateWidth: number;
270
- rateHeight: number;
271
- }
272
- export interface IStreamObj {
273
- stream: MediaStream | null;
274
- domStream: TCustomStream[];
275
- status: IStreamStatus;
276
- type: IStreamObjType;
277
- resolution: string;
278
- }
279
- export interface IStreamError {
280
- code: number;
281
- msg: string;
282
- detail: any;
283
- }
284
- export interface IStreamCurrent {
285
- type: IStreamCurrentType;
286
- detail: string | IStreamError;
287
- }
288
- export interface IPublishParams {
289
- isShareContent: boolean;
290
- isShareFile: boolean;
291
- isShareWhiteBoard: boolean;
292
- isSharePeople: boolean;
293
- }
294
- export interface IStreamSender {
295
- resolution: string;
296
- track: MediaStreamTrack;
297
- sender: RTCRtpSender;
298
- status: string;
299
- type: string;
300
- }
301
- export interface ISource {
302
- appIcon: any;
303
- display_id: string;
304
- id: string;
305
- name: string;
306
- thumbnail: any;
307
- }
308
- export interface IRotationInfoItem {
309
- height: number;
310
- width: number;
311
- participantId: number;
312
- rotation: number;
313
- }
314
- export interface IRotationInfoTotalItem extends IRotationInfoItem {
315
- mediagroupid: number;
316
- id: string;
317
- }
318
- export interface IRotationInfo {
319
- content: IRotationInfoItem[];
320
- people: IRotationInfoItem[];
321
- total: IRotationInfoTotalItem[];
322
- }
323
- export interface ICustomLayout {
324
- pid: number;
325
- resolution: number;
326
- quality: number;
327
- mediagroupid: 0 | 1;
328
- }
329
- export interface IThidrCustomLayout {
330
- pid: number;
331
- quality: 'low' | 'normal' | 'high' | 'hd';
332
- isContent: boolean;
333
- }
334
- export interface ICustomMediaStream {
335
- streams: MediaStream[];
336
- track: MediaStreamTrack;
337
- }
338
- export interface ICustomStreamTrack {
339
- status: string;
340
- data: RTCTrackEvent | ICustomMediaStream;
341
- rest: {
342
- streamId: string;
343
- trackId: string;
344
- track: MediaStreamTrack;
345
- };
346
- }
347
- export interface ILayoutStream {
348
- isExist: boolean;
349
- track: MediaStreamTrack;
350
- video: MediaStream;
351
- videoTrackId: string;
352
- }
353
- export interface IInternels {
354
- bytesReceived: number;
355
- bytesReceivedSecond: number;
356
- bytesSent: number;
357
- bytesSentSecond: number;
358
- mimeType: string;
359
- timestamp: number;
360
- receiver: {
361
- [prop: string]: IReceiver;
362
- };
363
- sender: {
364
- [prop: string]: ISender;
365
- };
366
- }
367
- export interface IReceiver {
368
- bytesReceived: number;
369
- bytesReceivedSecond: number;
370
- frameHeight: number;
371
- frameWidth: number;
372
- framesDecoded: number;
373
- framesDecodedSecond: number;
374
- framesReceived: number;
375
- framesReceivedSecond: number;
376
- isContent: boolean;
377
- isSupport: boolean;
378
- jitterBufferDelay: number;
379
- keyFramesDecoded: number;
380
- nackCount: number;
381
- name: string;
382
- packetsReceived: number;
383
- pliCount: number;
384
- timestamp: number;
385
- type: string;
386
- expResolution: number;
387
- }
388
- export interface ISender {
389
- bytesSent: number;
390
- bytesSentSecond: number;
391
- frameHeight: number;
392
- frameWidth: number;
393
- framesEncoded: number;
394
- framesEncodedSecond: number;
395
- framesSent: number;
396
- framesSentSecond: number;
397
- hugeFramesSent: number;
398
- status: string;
399
- keyFramesEncoded: number;
400
- packetsSent: number;
401
- timestamp: number;
402
- type: string;
403
- expBandwidth: number;
404
- resolution: string;
405
- pliCount: number;
406
- }
407
- export interface IBASE_CONTRAINTS {
408
- frameRate: any;
409
- aspectRatio: number;
410
- resizeMode: 'crop-and-scale';
411
- }
412
- export interface ICONTENT_CONTRAINTS {
413
- cursor: string;
414
- aspectRatio: number;
415
- resizeMode: 'crop-and-scale';
416
- frameRate: any;
417
- logicalSurface: true;
418
- }
419
- export interface ISubTitle {
420
- callIndex: number;
421
- content: string;
422
- type: string;
423
- }
424
- export interface ISubTitleContent {
425
- fontFamily?: string;
426
- fontRGB?: string;
427
- scroll?: string;
428
- action?: string;
429
- location?: string;
430
- fontSize?: string;
431
- backgroundAlpha?: string;
432
- scrollSpeed?: string;
433
- content: string;
434
- backgroundRGB?: string;
435
- }
436
- export interface ISetting {
437
- inputValue: string;
438
- outputValue: string;
439
- videoInValue: string;
440
- }
441
- export interface IDeviceItem {
442
- deviceId: string;
443
- label: string;
444
- }
445
- export interface IDevices {
446
- audioInputList: IDeviceItem[];
447
- audioOutputList: IDeviceItem[];
448
- videoInList: IDeviceItem[];
449
- }
450
- declare type TDevice = {
451
- deviceId: string;
452
- kind: string;
453
- type: string;
454
- direction: 'audioinput' | 'output' | 'input';
455
- label: string;
456
- groupId: string;
457
- };
458
- export declare type IDeviceList = {
459
- audioInputList: TDevice[];
460
- audioOutputList: TDevice[];
461
- videoInList: TDevice[];
462
- };
463
- export declare type TCurrentSelectedDevice = {
464
- deviceId: string;
465
- groupId: string;
466
- label: string;
467
- };
468
- export declare type ICurrentSelectedDevice = {
469
- audioInput: TCurrentSelectedDevice;
470
- videoInput: TCurrentSelectedDevice;
471
- audioOutput: TCurrentSelectedDevice;
472
- };
473
- export declare type IDeviceManagerChangeValue = {
474
- nextDevice: ICurrentSelectedDevice;
475
- detail: IDeviceList;
476
- };
477
- export interface ICurrentPermission {
478
- microphone: TPermissionType;
479
- camera: TPermissionType;
480
- }
481
- export interface IPermissionChangeEvent extends Event {
482
- target: PermissionStatus;
483
- }
484
- export declare type IStreamInitConfog = {
485
- devices: {
486
- audioInputValue?: string;
487
- videoInValue?: string;
488
- audioOutputValue?: string;
489
- };
490
- };
491
- export declare type IAudioRenders = {
492
- [key: string]: {
493
- ele: any;
494
- };
495
- };
496
- export declare type IVideoRenders = {
497
- [key: string]: VideoManager;
498
- };
499
- export interface IOutputCustomLayout {
500
- [pid: string]: {
501
- resolution: number;
502
- quality: number;
503
- };
504
- }
505
- export interface ILayoutParams {
506
- rosters: IRoster[];
507
- speakerInfo: ISpeakerInfo;
508
- layout: ILayout[];
509
- templateMode: ITemplateMode;
510
- invite: IInvite;
511
- contentSenderPid: number;
512
- localHide: boolean;
513
- }
514
- export declare type ITemplateObj = {
515
- position: number[];
516
- resolution: IResolutionType;
517
- zIndex?: number;
518
- };
519
- export interface ITypeTemplate {
520
- [id: string]: ITemplateObj[];
521
- }
522
- export interface ITemplate {
523
- [type: string]: {
524
- length: number;
525
- temp: {
526
- [index: string]: ITemplateObj[];
527
- };
528
- rate: {
529
- [index: number]: number;
530
- };
531
- };
532
- }
533
- export interface IDefault {
534
- CLIENT_TYPE: string;
535
- INIT_INTERNELS: {
536
- bytesReceived: number;
537
- bytesReceivedSecond: number;
538
- bytesSent: number;
539
- bytesSentSecond: number;
540
- mimeType: string;
541
- timestamp: number;
542
- receiver: {};
543
- sender: {};
544
- };
545
- RESOLUTION: number;
546
- ROSTER: IRoster;
547
- SELF_MOCK_PID: number;
548
- HOR_CONTAINER_RATIO: number;
549
- VER_CONTAINER_RATIO: number;
550
- RATIO_MAP: {
551
- [id: number]: number;
552
- };
553
- MAP_RESOLUTION_INDEX: {
554
- [resolution: string]: number;
555
- };
556
- RESOLUTION_MAP: {
557
- [index: number]: number;
558
- };
559
- VIDE_BANDWIDTH_BIT: 1000;
560
- LOGIN_INFO: {
561
- callUri: string;
562
- securityKey: string;
563
- access_token: string;
564
- refresh_token: string;
565
- id: 0;
566
- displayName: string;
567
- };
568
- }
569
- export interface ILoginInfo {
570
- callUri?: string;
571
- securityKey: string;
572
- access_token: string;
573
- refresh_token?: string;
574
- id: number;
575
- displayName?: string;
576
- }
577
- export interface IErrorCodeList {
578
- version: string;
579
- zh_CN: {
580
- [key: string]: string;
581
- };
582
- zh_TW: {
583
- [key: string]: string;
584
- };
585
- en_US: {
586
- [key: string]: string;
587
- };
588
- }
589
- export interface IMUTE_MAP {
590
- [type: string]: {
591
- type: IVideoAudioMessageType;
592
- status: boolean;
593
- };
594
- }
595
- export interface IMeetingStatus {
596
- video: IVideoAudioType;
597
- audio: IVideoAudioType;
598
- }
599
- export interface IResultCustomLayoutItem {
600
- pid: number;
601
- resolution: number;
602
- mediagroupid: number;
603
- quality: number;
604
- }
605
- export declare type IResultCustomLayout = {
606
- customLayout: IResultCustomLayoutItem[];
607
- };
608
- export declare type IReqList = {
609
- isContent: boolean;
610
- callUri: string;
611
- resolution: IResolutionType;
612
- quality: IQualityType;
613
- };
614
- export interface IMeetingInfo {
615
- meetingId: string;
616
- callUri: string;
617
- }
618
- export {};
8
+ export * from './base';
9
+ export * from './client';
10
+ export * from './stream';
11
+ export * from './device';