@xylink/xy-rtc-sdk 3.8.0 → 3.9.0

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.
Files changed (45) hide show
  1. package/README.MD +37 -37
  2. package/lib/action/index.d.ts +21 -6
  3. package/lib/enum/client.d.ts +15 -0
  4. package/lib/enum/contraints.d.ts +33 -96
  5. package/lib/enum/device.d.ts +1 -0
  6. package/lib/enum/errorCode.d.ts +58 -1
  7. package/lib/enum/i18n.d.ts +39 -0
  8. package/lib/enum/index.d.ts +65 -16
  9. package/lib/index.d.ts +11 -8
  10. package/lib/main/client.d.ts +101 -71
  11. package/lib/main/deviceManager.d.ts +23 -4
  12. package/lib/main/helper.d.ts +2 -2
  13. package/lib/main/iauth.d.ts +14 -1
  14. package/lib/main/layoutManager.d.ts +43 -13
  15. package/lib/main/meeting.d.ts +75 -21
  16. package/lib/main/peer.d.ts +70 -121
  17. package/lib/main/qualityManager.d.ts +38 -9
  18. package/lib/main/stream.d.ts +237 -104
  19. package/lib/main/videoManager.d.ts +1 -9
  20. package/lib/tools/dbManager.d.ts +106 -0
  21. package/lib/tools/detect.d.ts +2 -2
  22. package/lib/tools/enum.d.ts +1 -1
  23. package/lib/tools/httpClient.d.ts +4 -4
  24. package/lib/tools/i18n.d.ts +1 -1
  25. package/lib/tools/logger.d.ts +75 -74
  26. package/lib/tools/logger.worker.d.ts +13 -0
  27. package/lib/tools/quality.d.ts +113 -0
  28. package/lib/tools/quality.worker.d.ts +13 -0
  29. package/lib/tools/queue.d.ts +38 -3
  30. package/lib/tools/template.d.ts +8 -1
  31. package/lib/tools/utils.d.ts +8 -0
  32. package/lib/type/base.d.ts +2 -2
  33. package/lib/type/client.d.ts +286 -183
  34. package/lib/type/device.d.ts +21 -15
  35. package/lib/type/index.d.ts +3 -0
  36. package/lib/type/layout.d.ts +25 -6
  37. package/lib/type/logger.d.ts +112 -0
  38. package/lib/type/meeting.d.ts +29 -0
  39. package/lib/type/peer.d.ts +20 -0
  40. package/lib/type/quality.d.ts +101 -0
  41. package/lib/type/stream.d.ts +340 -102
  42. package/lib/xyrtc.cjs.js +1 -1
  43. package/lib/xyrtc.umd.js +1 -1
  44. package/package.json +119 -119
  45. package/lib/tools/db.d.ts +0 -85
@@ -6,16 +6,16 @@
6
6
  * @email luojinghui424@gmail.com
7
7
  *
8
8
  * Created at : 2021-01-05 17:24:07
9
- * Last modified : 2023-01-12 11:18:44
9
+ * Last modified : 2023-06-16 16:53:23
10
10
  */
11
11
  import Logger from '../tools/logger';
12
- import { ILayout, IVideoRenders, IRoster, ITemplateObj, IScreenInfo, IMode, IOutputCustomLayout, ILayoutRoster, IResolutionType, IConfInfo, IPageInfo, IReqInfo, IQualityType } from '../type/index';
12
+ import { ILayout, IVideoRenders, IRoster, ITemplateObj, IScreenInfo, IMode, IOutputCustomLayout, ILayoutRoster, IConfInfo, IPageInfo, IReqInfo, VideoQuality, StreamResolutionLevel, TLayoutMap } from '../type/index';
13
13
  import Client from './client';
14
14
  export default class LayoutManager {
15
15
  logger: Logger;
16
16
  client: Client;
17
- customLayoutMap: Map<string, ILayout>;
18
- layoutList: Map<string, ILayout>;
17
+ customLayoutMap: TLayoutMap;
18
+ layoutMap: TLayoutMap;
19
19
  private videoManagers;
20
20
  private originOrderRosters;
21
21
  private orderRosterList;
@@ -27,7 +27,7 @@ export default class LayoutManager {
27
27
  private templateRate;
28
28
  private content;
29
29
  private screenInfo;
30
- private internelsLayout;
30
+ private internalsLayout;
31
31
  private forceFullScreenId;
32
32
  private localContent;
33
33
  private preConfInfo;
@@ -35,17 +35,17 @@ export default class LayoutManager {
35
35
  private pageInfo;
36
36
  private isLocalShareContent;
37
37
  constructor(client: Client);
38
- static getCustomLayoutItem(item: ILayout, resolution: IResolutionType, quality: IQualityType): {
38
+ static getCustomLayoutItem(item: ILayout, resolution: StreamResolutionLevel, quality: VideoQuality): {
39
39
  pid: number;
40
- resolution: IResolutionType;
41
- quality: IQualityType;
40
+ resolution: StreamResolutionLevel;
41
+ quality: VideoQuality;
42
42
  mediagroupid: number;
43
43
  };
44
44
  getNewLayout(): ILayout[];
45
45
  getOrderRosterList(): IRoster[];
46
46
  getOriginOrderRosters(): IRoster[];
47
- getLayoutList(): Map<string, ILayout>;
48
- getCustomLayoutList(): Map<string, ILayout>;
47
+ getLayoutMap(): TLayoutMap;
48
+ getCustomLayoutMap(): TLayoutMap;
49
49
  getTemplateRate(): {
50
50
  previous: number;
51
51
  next: number;
@@ -57,7 +57,7 @@ export default class LayoutManager {
57
57
  getForceFullScreenId(): string;
58
58
  getTemplateMode(): IMode;
59
59
  getConfInfo(): IConfInfo;
60
- getInternelsLayout(): IOutputCustomLayout;
60
+ getInternalsLayout(): IOutputCustomLayout;
61
61
  getLocalShareState(): boolean;
62
62
  setOrderRosterList(orderRosterList: IRoster[]): void;
63
63
  setOriginOrderRosters(originOrderRosters: IRoster[]): void;
@@ -67,7 +67,6 @@ export default class LayoutManager {
67
67
  * @param { string } id forceLayout roster id
68
68
  */
69
69
  setForceFullScreenId(id?: string): void;
70
- setTemplateMode(templateMode: IMode): void;
71
70
  setContentRosterItem(content: IRoster | null): void;
72
71
  setConfInfo(confInfo: IConfInfo): void;
73
72
  /**
@@ -105,6 +104,7 @@ export default class LayoutManager {
105
104
  */
106
105
  setVideoRenderer(key: string, wrapEleId: string): void;
107
106
  removeVideoRenderer(key: string, wrapEleId: string): void;
107
+ playLocalVideo(): Promise<void>;
108
108
  playVideo(keys?: string[]): Promise<void>;
109
109
  updateLocalTrack(): void;
110
110
  /**
@@ -148,6 +148,12 @@ export default class LayoutManager {
148
148
  * @param { ILayoutRoster[] } totalLayoutResultList
149
149
  */
150
150
  createAutoLayout(totalLayoutResultList: ILayoutRoster[]): void;
151
+ /**
152
+ * 重置templateMode
153
+ * 本地共享,则显示对称布局四画面
154
+ * 本地未共享,根据当前是否有content,显示默认布局
155
+ */
156
+ private resetTemplateMode;
151
157
  /**
152
158
  * 创建排好序的roster数据
153
159
  *
@@ -171,7 +177,6 @@ export default class LayoutManager {
171
177
  calculateNewLayoutList(): {
172
178
  roster: IRoster;
173
179
  position: number[];
174
- resolution: IResolutionType;
175
180
  zIndex: number;
176
181
  }[];
177
182
  calculateScreenInfo(): {
@@ -182,6 +187,12 @@ export default class LayoutManager {
182
187
  } | undefined;
183
188
  createLayout(): void;
184
189
  calculateOrderRosterList(): IRoster[];
190
+ /**
191
+ * [auto] 切换布局
192
+ *
193
+ * @param { IMode } templateMode 指定要切换的布局模式
194
+ * @returns { Promise<IMode> } 切换后的布局模式
195
+ */
185
196
  switchLayout(templateMode?: IMode): IMode;
186
197
  /**
187
198
  * 【内部方法】停止轮询时,清理无效的 videoManager 数据
@@ -210,5 +221,24 @@ export default class LayoutManager {
210
221
  * @param mediagroupid type
211
222
  */
212
223
  private getLayoutKeyByRotateInfo;
224
+ /**
225
+ * 镜像显示Local画面
226
+ */
213
227
  private localMirrorRotate;
228
+ /**
229
+ * 根据layout名称 获得 对应的 名称头像
230
+ *
231
+ * @param { string } displayName layout名称
232
+ * @returns { string } 名称头像 文字内容
233
+ */
234
+ private getLayoutTextAvatar;
235
+ /**
236
+ * 获取最终请流分辨率
237
+ * 1. 根据是否启用低性能模式
238
+ * 2. 根据企业配置转换请流分辨率
239
+ *
240
+ * @param { ITemplateResolution } resolution - layout模版分辨率
241
+ * @returns { resolutionLevel }
242
+ */
243
+ private convertResolutionLevel;
214
244
  }
@@ -2,22 +2,31 @@
2
2
  * Meeting Info Control
3
3
  *
4
4
  * Created at : 2022-10-27 13:58:22
5
- * Last modified : 2022-11-04 14:45:39
5
+ * Last modified : 2023-07-11 10:11:00
6
6
  */
7
- import { IConferenceInfo, IRecordPermission, IConfMgmtUrl, ILayout } from '../type';
7
+ import { IRecordPermission, IConfMgmtUrl, ILayout, IMediaConfig, IReqInfo, LayoutAvatarType, TLayoutMap } from '../type';
8
8
  import Client from './client';
9
9
  import Logger from '../tools/logger';
10
10
  declare class Meeting {
11
11
  private client;
12
- logger: Logger;
13
- conferenceInfo: IConferenceInfo;
12
+ private logger;
13
+ private conferenceInfo;
14
14
  private recordPermission;
15
15
  private cloudRoomInfo;
16
16
  private confMgmtUrl;
17
- private layoutAvatarMap;
17
+ private layoutImageAvatarMap;
18
+ private mediaConfig;
19
+ private rxBandwidth;
20
+ private enterpriseConfig;
18
21
  constructor(client: Client, logger: Logger);
19
22
  getRecordPermission(): IRecordPermission;
20
- getLayoutAvatarMap(): Map<string, string>;
23
+ getLayoutImageAvatarMap(): Map<string, {
24
+ url: string;
25
+ isCustom: boolean;
26
+ }>;
27
+ getEnterpriseMediaConfig(): IMediaConfig;
28
+ getRxBandwidth(): number;
29
+ getLayoutAvatarType(): LayoutAvatarType;
21
30
  /**
22
31
  * 登录用户信息和个人云会议室信息
23
32
  */
@@ -35,6 +44,55 @@ declare class Meeting {
35
44
  * @returns Promise<IConfMgmtUrl | null>
36
45
  */
37
46
  getConfMgmtUrl(): Promise<IConfMgmtUrl | null>;
47
+ /**
48
+ * 录制权限获取
49
+ *
50
+ * @public
51
+ * @return { IRecordPermission } 录制权限
52
+ */
53
+ checkPermissionWithMeetingNumber(): Promise<IRecordPermission>;
54
+ /**
55
+ * 录制存储空间检查
56
+ *
57
+ * @param { string } recordingUrl
58
+ * @return { IRecordPermission } 录制权限
59
+ */
60
+ checkStorageSpaceWithRecordingUrl(recordingUrl: string): Promise<IRecordPermission>;
61
+ /**
62
+ * 获取个人云会议室信息,包含入会密码和个人云会议室号
63
+ */
64
+ getCloudMeetingRooms(): Promise<void>;
65
+ /**
66
+ * 设置Layout头像
67
+ * 如果有自定义头像,无论oms配置什么,都显示自定义的图片头像
68
+ * 如果没有自定义头像,oms配置了人物头像,则显示人物头像,配置了名称头像,则显示名称头像(硬终端特殊)
69
+ *
70
+ * 硬终端设备,无论oms配置什么,都使用对应的人物图标
71
+ *
72
+ * @param { ILayout } layout 参会者Layout
73
+ * @param {string} key 参会者id
74
+ * @returns
75
+ */
76
+ setLayoutAvatar(layout: ILayout, key: string): void;
77
+ /**
78
+ * 处理layout图像
79
+ *
80
+ * @param { TLayoutMap } layoutListMap
81
+ */
82
+ handleLayoutAvatar(layoutListMap: TLayoutMap): Promise<void>;
83
+ /**
84
+ * 获取企业配置信息
85
+ * 1. 企业管理平台带宽配置
86
+ * 2. Web端请1080P能力
87
+ */
88
+ setEnterpriseConfig(): Promise<void>;
89
+ /**
90
+ * 根据企业配置媒体能力,得到最终的请流参数
91
+ *
92
+ * @param {IReqInfo[]} reqInfoList 请流列表数据
93
+ * @returns {IReqInfo[]}
94
+ */
95
+ convertReqList(reqInfoList: IReqInfo[]): IReqInfo[];
38
96
  /**
39
97
  * 获取详细的会控地址
40
98
  *
@@ -64,23 +122,18 @@ declare class Meeting {
64
122
  */
65
123
  private getMeetingInviteInfo;
66
124
  /**
67
- * 录制权限获取
125
+ * 企业配置信息
68
126
  *
69
- * @public
70
- * @return { IRecordPermission } 录制权限
127
+ * 1. 企业管理平台带宽配置
128
+ * 2. Web端请1080P能力配置
71
129
  */
72
- checkPermissionWithMeetingNumber(): Promise<IRecordPermission>;
130
+ private setEnterpriseMediaConfig;
73
131
  /**
74
- * 录制存储空间检查
132
+ * 企业配置信息
75
133
  *
76
- * @param { string } recordingUrl
77
- * @return { IRecordPermission } 录制权限
134
+ * 1. 头像配置
78
135
  */
79
- checkStorageSpaceWithRecordingUrl(recordingUrl: string): Promise<IRecordPermission>;
80
- /**
81
- * 获取个人云会议室信息,包含入会密码和个人云会议室号
82
- */
83
- getCloudMeetingRooms(): Promise<void>;
136
+ private setEnterpriseBuffetConfig;
84
137
  /**
85
138
  * 处理信令下发的等候室
86
139
  *
@@ -89,10 +142,11 @@ declare class Meeting {
89
142
  */
90
143
  private handleWaitingRoomInfo;
91
144
  /**
92
- * 处理layout图像
145
+ * 未获取头像的layout
93
146
  *
94
- * @param { ILayout[] } unAvatarList 需要获取头像的终端
147
+ * @param { TLayoutMap } layoutListMap
148
+ * @returns { ILayout[] }
95
149
  */
96
- handleLayoutAvatar(unAvatarList: ILayout[]): Promise<void>;
150
+ private getUnAvatarList;
97
151
  }
98
152
  export default Meeting;
@@ -4,7 +4,7 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-10-25 18:53:01
6
6
  */
7
- import { IInvite, IStreamObj, IStreamSender, IInternels, IPushType, ICandidate } from '../type';
7
+ import { IInvite, IStreamSender, ICandidate, PushType, ISenderMap } from '../type';
8
8
  import Client from './client';
9
9
  import Logger from '../tools/logger';
10
10
  import Stream from './stream';
@@ -14,27 +14,28 @@ import Stream from './stream';
14
14
  * @class Peer
15
15
  */
16
16
  export default class Peer {
17
- private connectTimmer;
17
+ private connectTimer;
18
18
  private connectCount;
19
19
  client: Client;
20
20
  peerConnection: RTCPeerConnection | null;
21
21
  logger: Logger;
22
22
  invite: IInvite;
23
23
  peerStatus: {
24
- peerconnectionStatus: string;
24
+ peerConnectionStatus: string;
25
25
  iceConnectionState: string;
26
26
  };
27
27
  stream: Stream;
28
28
  streamSenders: IStreamSender[];
29
- private senderTimmer;
30
- private internels;
31
- private isShareContent;
32
- private senderInterval;
33
- private isResendContentOffer;
29
+ senderMap: ISenderMap;
30
+ private senderTimer;
34
31
  private isRestartIceConnection;
35
32
  private isFirstConnected;
33
+ private videoCodecs;
34
+ private audioCodecs;
35
+ private qualityWorker;
36
36
  constructor(client: Client, stream: Stream);
37
- getInternels(): IInternels;
37
+ private initQualityWorker;
38
+ restart(): void;
38
39
  /**
39
40
  * 初始化Peer模块
40
41
  * 1. 创建PeerConnection
@@ -54,17 +55,17 @@ export default class Peer {
54
55
  */
55
56
  private sendEmmit;
56
57
  /**
57
- * 停止呼叫状态检查timmer
58
+ * 停止呼叫状态检查timer
58
59
  *
59
60
  * @private
60
61
  */
61
- private stopConnectTimmer;
62
+ private stopConnectTimer;
62
63
  /**
63
64
  * 监听peer连接状态,Timeout:40s
64
65
  *
65
66
  * @private
66
67
  */
67
- private initTimmer;
68
+ private initTimer;
68
69
  /**
69
70
  * ice协商回调事件
70
71
  *
@@ -98,18 +99,21 @@ export default class Peer {
98
99
  * 响应offer
99
100
  *
100
101
  * @public
101
- * @param { RTCSessionDescriptionInit } answer answerSDP内容,设置到peerconnection上
102
+ * @param { RTCSessionDescriptionInit } answer answerSDP内容,设置到peerConnection上
102
103
  */
103
104
  handleAnswer(answer: RTCSessionDescriptionInit): Promise<void>;
104
105
  /**
105
- * 对Track轨道进行动态带宽调整
106
+ * 对Track轨道进行动态带宽调整、帧率调整
106
107
  *
107
108
  * @public
108
109
  * @param { string } trackId Track轨道id
109
- * @param { number } bandwidth 需要限定的带宽值
110
+ * @param { Object } encodingParams 需要限定的带宽值、帧率值
110
111
  * @param { boolean } isIncreaseBase 带宽是否需要✖️系数1000
111
112
  */
112
- setBandWidth(trackId: string, bandwidth: number | undefined, isIncreaseBase: boolean | undefined, stream: MediaStream | null): Promise<void>;
113
+ setParameters(trackId: string, encodingParams: {
114
+ bandwidth: number;
115
+ frameRate?: number | undefined;
116
+ } | undefined, isIncreaseBase: boolean | undefined, stream: MediaStream | null): Promise<void>;
113
117
  /**
114
118
  * View the cb of ice connection status change
115
119
  * Maybe status:'new', 'checking', 'connected', 'completed', 'failed', 'disconnected', 'closed'
@@ -119,7 +123,7 @@ export default class Peer {
119
123
  */
120
124
  private onHandleIceConnectionStateChange;
121
125
  /**
122
- * peerconnection connect status change cb, only supports Chrome 72 or higher
126
+ * peerConnection connect status change cb, only supports Chrome 72 or higher
123
127
  * pc.connectionState: connected,disconnected,failed,closed,connecting,new
124
128
  *
125
129
  * @private
@@ -138,27 +142,27 @@ export default class Peer {
138
142
  close(): void;
139
143
  setRestartIceConnection(isRestartIceConnection?: boolean): void;
140
144
  /**
141
- * add Track for stream, default push all
145
+ * Push people and content tracks of stream
142
146
  *
143
147
  * @public
144
- * @param { Stream } stream Local stream
145
- * @param { IPushType } pushType 推送类型,all全推送,video只推送video,audio只推送audio, content只推送content video流
148
+ * @param { Stream } stream - Stream Library
149
+ * @param { PushType } pushType - 推送类型,All全推送、Video只推送video、Audio只推送audio、Content只推送content video流
146
150
  */
147
- publish(stream: Stream, pushType?: IPushType): void;
148
- reSendContentOffer(): void;
149
- resetContentStream(contentStreams: IStreamObj[]): void;
151
+ publish(stream: Stream, pushType: PushType): void;
150
152
  /**
151
- * 替换People Video Track轨道
153
+ * people and content sender status
152
154
  *
153
155
  * @public
154
156
  */
155
- replacePeopleVideoTrack(stream: Stream, kind?: string): void;
157
+ initSenderStatus(): void;
156
158
  /**
157
- * people and content sender status
159
+ * 计算发送/接收端internals统计数据,更新存储到到Layout结果数据中
160
+ * 自动每隔6s记录一次内容统计数据到数据库中
158
161
  *
159
- * @public
162
+ * @param { boolean } init - 是否执行初始化操作
163
+ * @private
160
164
  */
161
- initSenderStatus(): void;
165
+ private qualityProcess;
162
166
  /**
163
167
  * Reset content sender track
164
168
  *
@@ -166,140 +170,85 @@ export default class Peer {
166
170
  */
167
171
  closeContentStream(): void;
168
172
  /**
169
- * Get peerconnection status
173
+ * Get peerConnection status
170
174
  *
171
175
  * @public
172
176
  */
173
177
  getPeerStatus(): boolean;
174
178
  /**
175
- * 无流切换至有流,需向transceiver重新setStream/replaceTrack
179
+ * Worker回传的结果数据
176
180
  *
177
- * @public
178
- * @param { IStreamObj[] } streamList 流数据
179
- * @param { 'video' | 'audio' } kind 流类型
181
+ * @param { MessageEvent } event - Worker数据结构
180
182
  */
181
- setStream(streamList: IStreamObj[], kind: 'video' | 'audio'): void;
183
+ private onMeetingStats;
182
184
  /**
183
- * 计算发送/接收端internels统计数据,更新存储到到Layout结果数据中
184
- * 自动每隔6s记录一次内容统计数据到数据库中
185
- *
186
- * @private
185
+ * 获取基础的视频&音频发送Stats统计数据,通过worker计算返回最终的结果
187
186
  */
188
- private calcMeetingStats;
187
+ private sendSenderStats;
189
188
  /**
190
- * 过滤远端音频中没有带宽或者没有音量的数据
191
- *
192
- * @param { IInternels } internels
193
- * @returns
189
+ * 获取基础的音频Audio接收Stats统计数据,通过worker返回最终的结果
194
190
  */
195
- private filterInternels;
191
+ private sendAudioReceiverStats;
196
192
  /**
197
- * 计算丢包率
198
- *
199
- * @param sum 包的总数
200
- * @param lost 丢失包的数量
201
- * @returns 丢包率
193
+ * 获取基础的视频Video接收Stats统计数据,通过worker计算返回最终的结果
202
194
  */
203
- private getLost;
195
+ private sendVideoReceiverStats;
204
196
  /**
205
- * 批量向peer通道添加Track轨道数据
197
+ * 处理过滤后的StreamConfig数据
198
+ * 1、如果存在Sender,则使用replaceTrack方式替换Track
199
+ * 2、如果不存在Sender,则使用addTransceiver方式协商流通道
206
200
  *
207
- * @private
208
- * @param { IStreamObj[] } streamList 媒体流/协商流列表
201
+ * @param { IStreamConfig[] } streamConfigList 媒体流/协商流列表
209
202
  * @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
210
203
  */
211
- private addTransceiver;
204
+ private streamConfigProcessor;
212
205
  /**
213
- * 向peer添加Track轨道数据
214
- *
215
- * @private
216
- * @param { TCustomStream | MediaStreamTrack } track Track轨道数据
217
- * @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
218
- * @param { IStreamObj } item 自定义Stream流对象
219
- */
220
- private addStreamRenders;
221
- preferCodec(codecs: RTCRtpCodecCapability[], mimeType: string): RTCRtpCodecCapability[];
222
- /**
223
- * 向peer添加Track轨道数据
206
+ * 添加Track轨道数据
224
207
  *
225
208
  * @private
226
209
  * @param { TCustomStream | MediaStreamTrack } track Track轨道数据
227
210
  * @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
228
- * @param { IStreamObj } item 自定义Stream流对象
211
+ * @param { IStreamConfig } streamConfig 自定义Stream流配置
229
212
  */
230
- private addTransceiverByPeer;
213
+ private addTrackProcessor;
231
214
  /**
232
- * 关联自定义stream对象和Sender发送器数据
215
+ * 设置编解码器
216
+ * 兼容:chrome:67+、edge:79、safari:13.1、firefox:不支持
233
217
  *
234
- * @private
235
218
  * @param { TCustomStream | MediaStreamTrack } track Track轨道数据
236
- * @param { IStreamObj } item 自定义Stream流对象
237
219
  * @param { RTCRtpTransceiver } rtcRtpTransceiver 流的发送器,由向peer添加track生成
238
220
  */
239
- private setStreamSenders;
240
- /**
241
- * 替换音频Track轨道
242
- *
243
- * @private
244
- * @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
245
- */
246
- private replaceAudioTrack;
221
+ private setCodecPreferences;
247
222
  /**
248
- * 替换视频Track轨道
249
- *
250
- * @private
251
- * @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
223
+ * 缓存浏览器支持所有可用的编解码器配置信息
252
224
  */
253
- private replaceVideoTrack;
225
+ private setSupportCodec;
254
226
  /**
255
- * Replace all Track
227
+ * 替换Sender发送器中的Track数据
256
228
  *
257
- * @private
258
- * @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
229
+ * @param { MediaStreamTrack } track - MediaStreamTrack数据
230
+ * @param { IStreamConfig } streamConfig - 自定义流配置
231
+ * @param { RTCRtpTransceiverDirection } direction - 通道方向
259
232
  */
260
- private replaceTrack;
233
+ private replaceTrackProcessor;
261
234
  /**
262
- * 获取sender的发送数据
263
- *
264
- * @private
265
- * @param { 'sender' | 'audioSender' } key
266
- * @param { RTCStatsReport } stats sender发送器的统计数据
267
- * @param { IInternels } internels 自定义internels统计数据
268
- * @param { IStreamSender } senderItem sender发送器对象
269
- * @param { boolean } firstMatch match第一次数据,记录一些通用数据
270
- * @returns { ISender } 自定义统计数据内容
271
- */
272
- private getSenderStatus;
273
- /**
274
- * 计算音量值, 显示0-100
275
- *
276
- * @param { number } audioLevel
277
- * @returns
278
- */
279
- private calcAudioLevel;
280
- /**
281
- * 获取receiver的数据
235
+ * 向peer添加Track轨道数据
282
236
  *
283
237
  * @private
284
- * @param { RTCStatsReport } stats sender发送器的统计数据
285
- * @param { ILayout } layoutItem layout布局数据
286
- * @param { IInternels } internels 自定义internels统计数据
287
- * @returns { IReceiver } 接收端的统计数据
238
+ * @param { TCustomStream | MediaStreamTrack } track Track轨道数据
239
+ * @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
240
+ * @param { IStreamConfig } streamConfig 自定义Stream流对象
288
241
  */
289
- private getReceiverStatus;
290
- private getReceiverAudioTrackStatus;
242
+ private addTransceiver;
291
243
  /**
292
- * 计算速率
244
+ * 关联自定义stream对象和Sender发送器数据
293
245
  *
294
246
  * @private
295
- * @param { any } report 上一次report总值
296
- * @param { string } accumulativeMetric key
297
- * @param { string } samplesMetric timeLong
298
- * @param { number } bitsRate bite转换值
299
- * @param { number } timeRatio 事件单位
300
- * @param { any } dataOrigin 上一次的数据
247
+ * @param { TCustomStream | MediaStreamTrack } track Track轨道数据
248
+ * @param { IStreamConfig } item 自定义Stream流对象
249
+ * @param { RTCRtpTransceiver } rtcRtpTransceiver 流的发送器,由向peer添加track生成
301
250
  */
302
- private rateBytesCalculator;
251
+ private setSenderMap;
303
252
  /**
304
253
  * 监听远端更新Track事件
305
254
  *
@@ -1,21 +1,41 @@
1
1
  import Client from './client';
2
- import LayoutManager from './layoutManager';
3
- import { IInternels } from '../type';
2
+ import { IConfInfo, IInternals } from '../type';
4
3
  declare class QualityManager {
5
4
  private client;
6
- private reportDataTimer;
5
+ private reportDataTime;
7
6
  private meetingQualityData;
8
- private layoutManager;
9
7
  private previousInternals;
10
8
  private internals;
11
9
  private participantCount;
12
- constructor(client: Client, layoutManager: LayoutManager);
10
+ private nqLevelTimer;
11
+ private isReportLocalNetworkLevel;
12
+ private networkLevel;
13
+ constructor(client: Client);
14
+ /**
15
+ * 上报本地网络质量
16
+ *
17
+ * 根据拉流和推流网络等级,计算一个最小的level值作为质量等级
18
+ *
19
+ * @param { boolean } isReportLocalNetworkLevel 是否给媒体上报网络质量
20
+ */
21
+ reportLocalNetworkLevel(isReportLocalNetworkLevel?: boolean): void;
13
22
  /**
14
23
  * 定时上报会议质量、网络数据
15
24
  *
16
25
  * @private
17
26
  */
18
- reportQualityData(internals: IInternels): void;
27
+ reportQualityData(internals: IInternals, confInfo?: IConfInfo): void;
28
+ /**
29
+ * 停止上报网络数据
30
+ *
31
+ * @private
32
+ */
33
+ stopReportData(): void;
34
+ /**
35
+ * 清除网络信号统计定时器
36
+ *
37
+ */
38
+ private clearNqLevelTimer;
19
39
  /**
20
40
  * webrtc audioLevel 转换成 播放能量
21
41
  * @param audioLevel
@@ -31,10 +51,19 @@ declare class QualityManager {
31
51
  */
32
52
  private calcQualityData;
33
53
  /**
34
- * 停止上报网络数据
54
+ * 根据上下行 丢包率、往返延时、wss重连次数 计算本地网络质量
35
55
  *
36
- * @private
56
+ * @param { boolean } isImmediate 是否立即上报,默认false, 如果是true,则不对比上一次的level, 直接上报
37
57
  */
38
- stopReportData(): void;
58
+ private calcLocalNetworkLevel;
59
+ /**
60
+ * 根据丢包率、往返延时、ws重连次数 计算网络信号等级
61
+ *
62
+ * @param { number } loss 丢包率
63
+ * @param { number } rtt 往返延时
64
+ * @param { number } wsReConnectCount ws重连次数
65
+ * @returns { number } level 计算得到的网络信号等级
66
+ */
67
+ private calcNetQualityLevel;
39
68
  }
40
69
  export default QualityManager;