@xylink/xy-rtc-sdk 2.0.6 → 2.1.2-beta.7

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.
@@ -4,15 +4,17 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-10-23 12:04:44
6
6
  */
7
- import { IClientConfig, IMackCall, IInvite, IRoster, ILayoutRoster, ISpeakerInfo, IScreenInfo, IServers, ILoginExtAccount, ISdkUserInfo, IPublishParams, ICustomLayout, ICustomStreamTrack, IInternels, IVideoAudioType, ISahreContentStatus, IPushType, IMode, IReqInfo, TCommand, ILayout, IConference, IContentMode } from '../type';
7
+ import { IClientConfig, IMackCall, IInvite, IRoster, ILayoutRoster, ISpeakerInfo, IScreenInfo, IServers, ILoginExtAccount, IPublishParams, ICustomLayout, ICustomStreamTrack, IInternels, IVideoAudioType, IShareContentStatus, IPushType, IMode, IReqInfo, TCommand, ILayout, IConference, IConferenceInfo, IContentMode, IToken, AutoMute, Key, IRecordPermission, TLocalLanguage } from '../type';
8
8
  import Emmitter from '../tools/emmitter';
9
9
  import Socket from '../tools/socket';
10
10
  import Stream from './stream';
11
11
  import Logger from '../tools/logger';
12
+ import IAuth from './iauth';
12
13
  import DeviceManager from './deviceManager';
13
14
  import LayoutManager from './layoutManager';
14
15
  export default class Client extends Emmitter {
15
16
  logger: Logger;
17
+ iauth: IAuth;
16
18
  socketTask: Socket | undefined;
17
19
  invite: IInvite;
18
20
  rosters: IRoster[];
@@ -27,7 +29,7 @@ export default class Client extends Emmitter {
27
29
  pushType: IPushType;
28
30
  isAutoBandwidth: boolean;
29
31
  debug: boolean;
30
- shareContentStatus: ISahreContentStatus;
32
+ shareContentStatus: IShareContentStatus;
31
33
  deviceManager: DeviceManager | null;
32
34
  localHide: boolean;
33
35
  hideId: string;
@@ -41,9 +43,7 @@ export default class Client extends Emmitter {
41
43
  private peer;
42
44
  private servers;
43
45
  private callInfo;
44
- private loginInfo;
45
46
  private stream;
46
- private meetingControl;
47
47
  private videoTrackList;
48
48
  private audioTrackList;
49
49
  private cacheMeetingControlMessage;
@@ -60,14 +60,18 @@ export default class Client extends Emmitter {
60
60
  private autoSwitchDevice;
61
61
  private audioManagers;
62
62
  private errorcode;
63
+ private i18nCode;
63
64
  private clientErrorState;
64
65
  private limitResolution;
65
- private reportDataTimer;
66
- private reportDataFrequency;
67
- private meetingQualityData;
68
66
  private conferenceInfo;
69
67
  private customLayoutCacheList;
70
68
  private contentMode;
69
+ private contentOnholdInfo;
70
+ private isSubscribeBulkRoster;
71
+ private recordPermission;
72
+ private recordState;
73
+ private qualityManager;
74
+ private isShareContent;
71
75
  private onDocumentChange;
72
76
  constructor(config: IClientConfig, servers: IServers, logger: Logger);
73
77
  static instance: Client;
@@ -78,19 +82,6 @@ export default class Client extends Emmitter {
78
82
  quality: number;
79
83
  mediagroupid: number;
80
84
  };
81
- static getMeetingStatus(success: boolean, code?: string, msg?: string): {
82
- success: boolean;
83
- data: {
84
- code: string;
85
- msg: string | undefined;
86
- };
87
- } | {
88
- success: boolean;
89
- data: {
90
- code?: undefined;
91
- msg?: undefined;
92
- };
93
- };
94
85
  getClientConfig(): IClientConfig;
95
86
  getVideoManagers(): import("../type").IVideoRenders | undefined;
96
87
  getPreviewStreams(): import("../type").IGetMediaStreams | {
@@ -103,6 +94,7 @@ export default class Client extends Emmitter {
103
94
  total: ILayoutRoster[];
104
95
  };
105
96
  getOriginRosters(): IRoster[];
97
+ getConferenceInfo(): IConferenceInfo | null;
106
98
  getInviteInfo(): IInvite;
107
99
  getContentSenderPid(): number;
108
100
  getSpeakerInfo(): ISpeakerInfo;
@@ -110,8 +102,37 @@ export default class Client extends Emmitter {
110
102
  getRotationInfo(): import("../type").IRotationInfoTotalItem[];
111
103
  getPeerConnectionStatus(): boolean;
112
104
  getOnHold(): boolean;
105
+ getAudioTrackList(): ICustomStreamTrack[];
113
106
  getLayoutList(): Map<string, ILayout> | undefined;
107
+ /**
108
+ * 获取Local roster信息
109
+ *
110
+ * @returns { IRoster}
111
+ */
114
112
  getSelfRoster(): IRoster | undefined;
113
+ /**
114
+ * 获取本地是否在分享content
115
+ *
116
+ * @returns { boolean }
117
+ */
118
+ getLocalShareContent(): boolean;
119
+ /**
120
+ * 小鱼账号初始登录,获取token方法
121
+ *
122
+ * @public
123
+ * @param { string } userName 小鱼用户账号
124
+ * @param { string } password 小鱼用户账号密码
125
+ * @returns { Promise<Object> } { access_token }
126
+ */
127
+ loginXYlinkAccount(userName: string, password: string): Promise<Object>;
128
+ /**
129
+ * 第三方登录方法
130
+ *
131
+ * @public
132
+ * @param { ILoginExtAccount } params 参数
133
+ * @return { Promise<Object> } 登录结果
134
+ */
135
+ loginExternalAccount(params: ILoginExtAccount): Promise<Object>;
115
136
  /**
116
137
  * 退会时 重置初始化参数
117
138
  *
@@ -138,14 +159,14 @@ export default class Client extends Emmitter {
138
159
  * 绑定streamId和video ele元素,内部维护状态
139
160
  *
140
161
  * @public
141
- * @param { string } key endpoinId + mediagroupId 唯一的用户id值
162
+ * @param { string } key endpointId + mediagroupId 唯一的用户id值
142
163
  * @param { string } wrapEle 包裹video组件的元素id,此元素一定要提供宽高信息,内部会基于此宽高信息计算video的旋转信息
143
164
  */
144
165
  setVideoRenderer(key: string, wrapEleId: string): void;
145
166
  /**
146
167
  * 移除绑定的streamId
147
168
  *
148
- * @param { string } key endpoinId + mediagroupId 唯一的用户id值
169
+ * @param { string } key endpointId + mediagroupId 唯一的用户id值
149
170
  * @param { string } wrapEle 包裹video组件的元素id,此元素一定要提供宽高信息,内部会基于此宽高信息计算video的旋转信息
150
171
  */
151
172
  removeVideoRender(key: string, wrapEleId: string): void;
@@ -195,6 +216,18 @@ export default class Client extends Emmitter {
195
216
  * @private
196
217
  */
197
218
  private handleConferenceInfo;
219
+ /**
220
+ * 检查会议室录制权限
221
+ *
222
+ * @public
223
+ */
224
+ checkPermissionWithMeetingNumber(): Promise<IRecordPermission>;
225
+ /**
226
+ * 录制存储空间检查
227
+ *
228
+ * @param { string } recordingUrl
229
+ */
230
+ checkStorageSpaceWithRecordingUrl(recordingUrl: string): Promise<any>;
198
231
  /**
199
232
  * 处理wss返回的数据
200
233
  *
@@ -220,15 +253,15 @@ export default class Client extends Emmitter {
220
253
  /**
221
254
  * 开始会议,发送start call消息,通知后台服务
222
255
  *
223
- * @public
256
+ * @private
224
257
  */
225
- startCall(): void;
258
+ private startCall;
226
259
  /**
227
260
  * 结束会议,发送stop call消息,通知后台服务
228
261
  *
229
- * @public
262
+ * @private
230
263
  */
231
- stopCall(reason: 'OK' | 'SERVER_INNER_ERROR' | 'PEER_NET_DISCONNECT' | 'LOCAL_NET_DISCONNECT' | string): void;
264
+ private stopCall;
232
265
  /**
233
266
  * 建会准备工作完成,通过publish开始多人会议
234
267
  *
@@ -247,7 +280,7 @@ export default class Client extends Emmitter {
247
280
  * @public
248
281
  * @param { Stream } stream 本地contentStream
249
282
  */
250
- sendContentCapablityMessage(stream?: Stream): void;
283
+ sendContentCapabilityMessage(stream?: Stream): void;
251
284
  /**
252
285
  * 分享content
253
286
  *
@@ -261,74 +294,64 @@ export default class Client extends Emmitter {
261
294
  * @returns { Promise<Boolean> } 停止分享content是否成功
262
295
  */
263
296
  stopShareContent(): Promise<Boolean>;
264
- initTrackEvent(): void;
265
- mergeTrackList(e: RTCTrackEvent): void;
266
297
  /**
267
- * 挂断会议,销毁资源
298
+ * 监听 video/audio track
268
299
  */
269
- destroy(): Promise<boolean>;
270
- close(reason?: string): void;
300
+ private initTrackEvent;
271
301
  /**
272
- * 小鱼账号初始登录,获取token方法
302
+ * content onhold时,处理content audio
273
303
  *
274
- * @public
275
- * @param { string } userName 小鱼用户账号
276
- * @param { string } password 小鱼用户账号密码
277
- * @returns { Promise<Object> } { access_token }
304
+ * @private
305
+ * @param { ITrackInfo } rest
278
306
  */
279
- loginXYlinkAccount(userName: string, password: string): Promise<Object>;
307
+ private handleContentOnholdAudio;
280
308
  /**
281
- * 获取第三方user info & 获取token方法
309
+ * 合并track
282
310
  *
283
- * @param { string } userName
284
- * @param { string } password
311
+ * @param { RTCTrackEvent } e
285
312
  */
286
- getExternalLoginInfo(sdkUserInfo: ISdkUserInfo, params: ILoginExtAccount): Promise<{
287
- code: string;
288
- msg: string;
289
- detail: any;
290
- }>;
313
+ private mergeTrackList;
291
314
  /**
292
- * 第三方登录方法
293
- *
294
- * @public
295
- * @param { ILoginExtAccount } params 参数
296
- * @return { Promise<Object> } 登录结果
315
+ * 挂断会议,销毁资源
297
316
  */
298
- loginExternalAccount(params: ILoginExtAccount): Promise<Object>;
317
+ destroy(): Promise<boolean>;
318
+ close(reason?: string): void;
299
319
  /**
300
320
  * 获取随机云会议室 - 目前用于教育
301
321
  *
302
322
  * @public
303
- * @param { string } id
323
+ * @param { string } id userProfileId
304
324
  * @param { string } sk
305
- * @param { string } token
325
+ * @param { IToken } token
326
+ * @param { AutoMute } autoMute 是否静音,0:智能静音 1:全部静音 2:不静音 3:强制静音
306
327
  * @returns { Promise<IConference> } 云会议室信息
307
328
  */
308
- getConference(id?: number, sk?: string, token?: string): Promise<IConference>;
329
+ getConference(id: number | undefined, sk: string | undefined, token: IToken, params?: {
330
+ autoMute: AutoMute;
331
+ }): Promise<IConference>;
309
332
  /**
310
- * 获取错误码json链接
333
+ * 获取错误码/i18n等json链接
311
334
  *
312
335
  * @private
313
336
  * @returns
314
337
  */
315
- private fetchErrorCode;
338
+ private getServerConfig;
316
339
  /**
317
- * 根据链接获取错误码
340
+ * 获取链接内容
318
341
  *
319
- * @private
320
- * @param { string } link
321
- * @returns { Promise<IErrorCodeList> } 错误码
342
+ * @param { string } configName 'errorcode' | 'i18n'
343
+ * @param data
344
+ * @returns
322
345
  */
323
- private getErrorCodeByJson;
346
+ private getCodeByJson;
324
347
  /**
325
348
  * 音视频开启关闭操作
326
349
  *
327
- * @public
350
+ * @private
328
351
  * @param { 'muteAudio' | 'muteVideo' | 'unmuteAudio' | 'unmuteVideo' } type 操作类型
329
352
  * @returns Promise<IVideoAudioType> 类型
330
353
  */
331
- videoAudioOperate(type: IVideoAudioType): Promise<IVideoAudioType>;
354
+ private videoAudioOperate;
332
355
  /**
333
356
  * 静音 操作
334
357
  *
@@ -357,6 +380,14 @@ export default class Client extends Emmitter {
357
380
  * @returns { Promise<IVideoAudioType> } 操作类型
358
381
  */
359
382
  unmuteVideo(): Promise<IVideoAudioType>;
383
+ /**
384
+ * 更新设备的声音状态
385
+ * @scene 教育平台-巡课
386
+ * @param type mute: 静音;unmute: 取消静音;
387
+ * @param callUriList 操作的设备的 callUri 或者 callUri 列表
388
+ * @returns [hasError, data]
389
+ */
390
+ setPollingAudioStatus(type: 'mute' | 'unmute', callUriList: string | string[]): Promise<any>;
360
391
  /**
361
392
  * 举手发言 操作
362
393
  *
@@ -378,7 +409,21 @@ export default class Client extends Emmitter {
378
409
  * @returns { Promise<boolean> } 是否举手
379
410
  */
380
411
  onMute(): Promise<boolean>;
412
+ /**
413
+ * 本地举手、结束发言等操作
414
+ *
415
+ * @private
416
+ * @param { 'handup' | 'handdown' | 'mute' } type 操作类型
417
+ * @param { boolean } handStatus 是否举手
418
+ * @returns { Promise<boolean> } 举手状态
419
+ */
381
420
  private onHand;
421
+ /**
422
+ * 告知媒体是否开启出入会通知
423
+ *
424
+ * @private
425
+ */
426
+ private sendConfParam;
382
427
  /**
383
428
  * 获取可支持的编解码
384
429
  *
@@ -421,6 +466,13 @@ export default class Client extends Emmitter {
421
466
  * @param { any } data 媒体消息
422
467
  */
423
468
  private onPassThroughMessage;
469
+ /**
470
+ * 处理contentOnhold
471
+ *
472
+ * @private
473
+ * @param { IConfProperty } info
474
+ */
475
+ private handleContentOnhold;
424
476
  /**
425
477
  * 是否开启自动调整带宽
426
478
  *
@@ -432,7 +484,8 @@ export default class Client extends Emmitter {
432
484
  * 当websocket error,挂断会议
433
485
  *
434
486
  * @private
435
- * @param { string } code 错误码
487
+ * @param { string } errorCode 错误码
488
+ * @param { TErrorReason } detail 详情
436
489
  */
437
490
  private disconnectInWssError;
438
491
  /**
@@ -481,12 +534,19 @@ export default class Client extends Emmitter {
481
534
  requestAutoPollingLayout(command: TCommand, interval: number | undefined, reqList: IReqInfo[]): Promise<boolean>;
482
535
  /**
483
536
  * 应用替换已经更新的的people video track轨道流,如果之前无流,则需重新setStream, replaceTrack
537
+ * 第一次开启音频、或视频,需重新协商offer。改变通道方向
484
538
  *
485
539
  * @public
486
540
  * @param { 'video' | 'audio' } kind 设备类型
487
541
  * @param { boolean } isFirst 是否之前无流
488
542
  */
489
543
  applyVideoOrAudio(kind: 'video' | 'audio', isFirst?: boolean): void;
544
+ /**
545
+ * 上报audio状态
546
+ *
547
+ * @param { boolean | string } status
548
+ */
549
+ sendAudioStatus(status: boolean | string): void;
490
550
  /**
491
551
  * 发布layout数据
492
552
  *
@@ -512,17 +572,17 @@ export default class Client extends Emmitter {
512
572
  */
513
573
  sendCustomLayoutMessage(): void;
514
574
  /**
515
- * 发布Layout Cotnaienr的容器信息
575
+ * 发布Layout Container的容器信息
516
576
  *
517
577
  * @public
518
- * @param { IScreenInfo } screenInfo Layout Cotnaienr的容器信息
578
+ * @param { IScreenInfo } screenInfo Layout Container的容器信息
519
579
  */
520
580
  sendScreenInfoMessage(screenInfo: IScreenInfo): void;
521
581
  /**
522
582
  * 发布当前正在分享 content 的用户详细信息
523
583
  *
524
584
  * @public
525
- * @param { IRoster | null } next content想起信息
585
+ * @param { IRoster | null } next content详细信息
526
586
  */
527
587
  sendContentRosterMessage(next: IRoster | null): void;
528
588
  /**
@@ -552,6 +612,20 @@ export default class Client extends Emmitter {
552
612
  * @param { ICustomLayout[] } customLayout 计算得到的customLayout List数据
553
613
  */
554
614
  sendCustomLayout(customLayout?: ICustomLayout[]): void;
615
+ /**
616
+ * 上报会议质量数据
617
+ *
618
+ * @public
619
+ * @param { IInternels } internels Internels统计数据
620
+ */
621
+ reportQualityData(internels: IInternels): void;
622
+ /**
623
+ * Internels统计数据-期望带宽
624
+ *
625
+ * @param internels
626
+ * @returns
627
+ */
628
+ private getInternels;
555
629
  /**
556
630
  * 发布Internels统计数据
557
631
  *
@@ -596,7 +670,7 @@ export default class Client extends Emmitter {
596
670
  * @param { string } id rosterId
597
671
  * @returns Promise<string> rosterId
598
672
  */
599
- forceFullScreen(id: string): Promise<string>;
673
+ forceFullScreen(id?: string): Promise<string>;
600
674
  /**
601
675
  * 发送websocket消息方法
602
676
  *
@@ -606,6 +680,7 @@ export default class Client extends Emmitter {
606
680
  * @param { boolean } isLog 是否写入日志
607
681
  */
608
682
  sendSocketMessage(data: any, isAutoAdd?: boolean, isLog?: boolean): void;
683
+ private getBasicInfo;
609
684
  /**
610
685
  * 校验会议室号
611
686
  *
@@ -621,6 +696,12 @@ export default class Client extends Emmitter {
621
696
  * @param { string } deviceId 设备ID
622
697
  */
623
698
  setAudioOutputDevice(deviceId: string): void;
699
+ /**
700
+ * 移除对应的AudioRender
701
+ *
702
+ * @param { string } key endpointId + mediagroupId 唯一的用户id值
703
+ */
704
+ removeAudioRender(key: string): void;
624
705
  /**
625
706
  * 开始巡课
626
707
  *
@@ -641,26 +722,64 @@ export default class Client extends Emmitter {
641
722
  * @public
642
723
  */
643
724
  subscribeBulkRoster(): Promise<unknown>;
644
- reSendContentOffer(): void;
645
725
  /**
646
- * 定时上报会议质量、网络数据
726
+ * 开启同传字幕消息
647
727
  *
648
- * @private
728
+ * @public
649
729
  */
650
- private reportQualityData;
730
+ startTranslation(): Promise<unknown>;
651
731
  /**
652
- * 发送会议质量数据
732
+ * 停止同传字幕消息
653
733
  *
654
- * @param { boolean ? } isLast 挂断状态
655
- * @private
734
+ * @public
656
735
  */
657
- private calcQualityData;
736
+ stopTranslation(): Promise<unknown>;
658
737
  /**
659
- * 停止上报网络数据
738
+ * 同传字幕: 设置本地说话的语言
660
739
  *
661
- * @private
740
+ * @param { TLocalLanguage } language
741
+ * @returns
742
+ */
743
+ setTranslationLanguage(language: TLocalLanguage): Promise<unknown>;
744
+ /**
745
+ * 开启云端录制
746
+ *
747
+ * @public
748
+ */
749
+ startCloudRecord(): Promise<undefined>;
750
+ /**
751
+ * 停止录制
752
+ *
753
+ * @public
754
+ */
755
+ stopCloudRecord(): Promise<undefined>;
756
+ /**
757
+ * 配置web节点接收带宽
758
+ *
759
+ * @public
662
760
  */
663
- private stopReportData;
761
+ setWebRxBandwidth(): Promise<undefined>;
762
+ /**
763
+ * 重新发送content offer
764
+ *
765
+ * @public
766
+ */
767
+ reSendContentOffer(): void;
768
+ startMonitorGroup(mediagrpIds: Key[]): true | {
769
+ code: string;
770
+ msg: string;
771
+ detail: any;
772
+ };
773
+ stopMonitorGroup(mediagrpIds: Key[]): true | {
774
+ code: string;
775
+ msg: string;
776
+ detail: any;
777
+ };
778
+ setMonitorGroup(type: 'start' | 'stop', mediagrpIds: Key[]): true | {
779
+ code: string;
780
+ msg: string;
781
+ detail: any;
782
+ };
664
783
  /**
665
784
  * 初始化DeviceManager事件
666
785
  *
@@ -6,7 +6,7 @@
6
6
  * @author jinghui-luo、chengfei
7
7
  *
8
8
  * Created at : 2020-11-26 14:41:51
9
- * Last modified : 2021-09-15 16:36:15
9
+ * Last modified : 2022-06-09 17:33:47
10
10
  */
11
11
  import Logger from '../tools/logger';
12
12
  import Emmitter from '../tools/emmitter';
@@ -112,7 +112,7 @@ declare class DeviceManager extends Emmitter {
112
112
  * 获取摄像头和麦克风权限方法,初始化时直接调用
113
113
  *
114
114
  * TODO:兼容方式通过获取devices设备去检测是否授予了权限
115
- * TODO:可以通过loopling的形式检测,后续在处理
115
+ * TODO:可以通过looping的形式检测,后续在处理
116
116
  */
117
117
  getPermission(): Promise<ICurrentPermission>;
118
118
  /**
@@ -5,19 +5,19 @@
5
5
  * @email luojinghui424@gmail.com
6
6
  *
7
7
  * Created at : 2021-01-09 14:45:46
8
- * Last modified : 2021-12-08 11:16:01
8
+ * Last modified : 2022-06-09 17:35:24
9
9
  */
10
10
  import { ILayout, IVideoManagerState, IRotationInfoTotalItem } from '../type';
11
11
  export declare const getLayoutItemState: (item: ILayout | ILayout, stream: MediaStream | null, vmState: IVideoManagerState) => "REQUEST" | "MUTE" | "NORMAL" | "AUDIO_TEL" | "AUDIO_ONLY" | "AUDIO_CONTENT";
12
12
  /**
13
- * Get video real display size and roatate of transform infos
14
- * @param width video real width of reslution
15
- * @param height video real height of reslution
13
+ * Get video real display size and rotate of transform infos
14
+ * @param width video real width of resolution
15
+ * @param height video real height of resolution
16
16
  * @param containerHeight display video container size
17
17
  * @param containerWidth display video container size
18
18
  * @param rotate video real ratio
19
19
  */
20
- export declare const getVideoInfoByRotaion: (width: number, height: number, containerHeight: number, containerWidth: number, rotate: number) => {
20
+ export declare const getVideoInfoByRotation: (width: number, height: number, containerHeight: number, containerWidth: number, rotate: number) => {
21
21
  realWidth: number;
22
22
  realHeight: number;
23
23
  realRotate: number;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * 登录模块
3
+ *
4
+ */
5
+ import { ILoginExtAccount, ISdkUserInfo, ILoginInfo } from '../type';
6
+ import Logger from '../tools/logger';
7
+ declare class IAuth {
8
+ private logger;
9
+ private loginInfo;
10
+ constructor(logger: Logger);
11
+ getLoginInfo(): ILoginInfo;
12
+ setLoginInfo(loginInfo: ILoginInfo): void;
13
+ /**
14
+ * 第三方登录方法
15
+ *
16
+ * @public
17
+ * @param { ILoginExtAccount } params 参数
18
+ * @return { Promise<Object> } 登录结果
19
+ */
20
+ loginExternalAccount(params: ILoginExtAccount): Promise<Object>;
21
+ /**
22
+ * 登录
23
+ *
24
+ * @param { ISdkUserInfo } sdkUserInfo
25
+ * @param { ILoginExtAccount } params
26
+ */
27
+ login(sdkUserInfo: ISdkUserInfo, params?: ILoginExtAccount): Promise<{
28
+ code: string;
29
+ msg: string;
30
+ detail: any;
31
+ }>;
32
+ }
33
+ export default IAuth;