@xylink/xy-rtc-sdk 3.8.1 → 3.9.1-beta.6
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.
- package/lib/action/index.d.ts +29 -5
- package/lib/enum/client.d.ts +15 -0
- package/lib/enum/contraints.d.ts +30 -102
- package/lib/enum/device.d.ts +1 -0
- package/lib/enum/errorCode.d.ts +58 -1
- package/lib/enum/index.d.ts +53 -16
- package/lib/index.d.ts +11 -8
- package/lib/main/client.d.ts +157 -79
- package/lib/main/deviceManager.d.ts +23 -4
- package/lib/main/helper.d.ts +2 -2
- package/lib/main/iauth.d.ts +67 -5
- package/lib/main/layoutManager.d.ts +29 -11
- package/lib/main/meeting.d.ts +73 -35
- package/lib/main/peer.d.ts +70 -121
- package/lib/main/qualityManager.d.ts +38 -9
- package/lib/main/stream.d.ts +237 -104
- package/lib/main/videoManager.d.ts +1 -9
- package/lib/tools/config.d.ts +5 -1
- package/lib/tools/dbManager.d.ts +106 -0
- package/lib/tools/detect.d.ts +2 -2
- package/lib/tools/enum.d.ts +1 -1
- package/lib/tools/httpClient.d.ts +15 -23
- package/lib/tools/i18n.d.ts +1 -1
- package/lib/tools/logger.d.ts +75 -74
- package/lib/tools/logger.worker.d.ts +13 -0
- package/lib/tools/quality.d.ts +113 -0
- package/lib/tools/quality.worker.d.ts +13 -0
- package/lib/tools/queue.d.ts +38 -3
- package/lib/tools/template.d.ts +3 -3
- package/lib/tools/utils.d.ts +8 -0
- package/lib/type/action.d.ts +4 -0
- package/lib/type/base.d.ts +2 -2
- package/lib/type/client.d.ts +280 -186
- package/lib/type/device.d.ts +21 -15
- package/lib/type/iauth.d.ts +112 -0
- package/lib/type/index.d.ts +4 -0
- package/lib/type/layout.d.ts +18 -1
- package/lib/type/logger.d.ts +112 -0
- package/lib/type/meeting.d.ts +11 -2
- package/lib/type/peer.d.ts +20 -0
- package/lib/type/quality.d.ts +101 -0
- package/lib/type/stream.d.ts +332 -134
- package/lib/xyrtc.cjs.js +1 -1
- package/lib/xyrtc.umd.js +1 -1
- package/package.json +5 -4
- 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-
|
|
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, IConfInfo, IPageInfo, IReqInfo, VideoQuality, StreamResolutionLevel } 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:
|
|
18
|
-
|
|
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
|
|
30
|
+
private internalsLayout;
|
|
31
31
|
private forceFullScreenId;
|
|
32
32
|
private localContent;
|
|
33
33
|
private preConfInfo;
|
|
@@ -44,8 +44,8 @@ export default class LayoutManager {
|
|
|
44
44
|
getNewLayout(): ILayout[];
|
|
45
45
|
getOrderRosterList(): IRoster[];
|
|
46
46
|
getOriginOrderRosters(): IRoster[];
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
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: number;
|
|
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 数据
|
|
@@ -211,9 +222,16 @@ export default class LayoutManager {
|
|
|
211
222
|
*/
|
|
212
223
|
private getLayoutKeyByRotateInfo;
|
|
213
224
|
/**
|
|
214
|
-
*
|
|
225
|
+
* 镜像显示Local画面
|
|
215
226
|
*/
|
|
216
227
|
private localMirrorRotate;
|
|
228
|
+
/**
|
|
229
|
+
* 根据layout名称 获得 对应的 名称头像
|
|
230
|
+
*
|
|
231
|
+
* @param { string } displayName layout名称
|
|
232
|
+
* @returns { string } 名称头像 文字内容
|
|
233
|
+
*/
|
|
234
|
+
private getLayoutTextAvatar;
|
|
217
235
|
/**
|
|
218
236
|
* 获取最终请流分辨率
|
|
219
237
|
* 1. 根据是否启用低性能模式
|
package/lib/main/meeting.d.ts
CHANGED
|
@@ -2,26 +2,31 @@
|
|
|
2
2
|
* Meeting Info Control
|
|
3
3
|
*
|
|
4
4
|
* Created at : 2022-10-27 13:58:22
|
|
5
|
-
* Last modified : 2023-
|
|
5
|
+
* Last modified : 2023-07-27 10:02:44
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { IRecordPermission, IConfMgmtUrl, ILayout, IMediaConfig, IReqInfo, LayoutAvatarType, TLayoutMap, InviteInfo } 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
|
|
13
|
-
conferenceInfo
|
|
12
|
+
private logger;
|
|
13
|
+
private conferenceInfo;
|
|
14
14
|
private recordPermission;
|
|
15
15
|
private cloudRoomInfo;
|
|
16
16
|
private confMgmtUrl;
|
|
17
|
-
private
|
|
17
|
+
private layoutImageAvatarMap;
|
|
18
18
|
private mediaConfig;
|
|
19
19
|
private rxBandwidth;
|
|
20
|
+
private enterpriseConfig;
|
|
20
21
|
constructor(client: Client, logger: Logger);
|
|
21
22
|
getRecordPermission(): IRecordPermission;
|
|
22
|
-
|
|
23
|
+
getLayoutImageAvatarMap(): Map<string, {
|
|
24
|
+
url: string;
|
|
25
|
+
isCustom: boolean;
|
|
26
|
+
}>;
|
|
23
27
|
getEnterpriseMediaConfig(): IMediaConfig;
|
|
24
28
|
getRxBandwidth(): number;
|
|
29
|
+
getLayoutAvatarType(): LayoutAvatarType;
|
|
25
30
|
/**
|
|
26
31
|
* 登录用户信息和个人云会议室信息
|
|
27
32
|
*/
|
|
@@ -39,6 +44,55 @@ declare class Meeting {
|
|
|
39
44
|
* @returns Promise<IConfMgmtUrl | null>
|
|
40
45
|
*/
|
|
41
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[];
|
|
42
96
|
/**
|
|
43
97
|
* 获取详细的会控地址
|
|
44
98
|
*
|
|
@@ -65,26 +119,22 @@ declare class Meeting {
|
|
|
65
119
|
*
|
|
66
120
|
* TODO: 2022-10-27,携带meetingId的Info接口调用失败,原因是dcs(大数据当前服务)接口在入会后存在15s延迟,导致info返回403错误;
|
|
67
121
|
* TODO:2022-10-27,此处使用inviteUrl地址,暂时不使用微信邀请链接地址,原因是会议号获取的微信邀请链接页面访问失效,需要提供MeetingId字段才行;
|
|
122
|
+
* 2023-8-3 鉴于安全考虑,此接口需提供MeetingId字段;
|
|
68
123
|
*/
|
|
69
|
-
|
|
124
|
+
getMeetingInviteInfo(): Promise<InviteInfo>;
|
|
70
125
|
/**
|
|
71
|
-
*
|
|
126
|
+
* 企业配置信息
|
|
72
127
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
128
|
+
* 1. 企业管理平台带宽配置
|
|
129
|
+
* 2. Web端请1080P能力配置
|
|
75
130
|
*/
|
|
76
|
-
|
|
131
|
+
private setEnterpriseMediaConfig;
|
|
77
132
|
/**
|
|
78
|
-
*
|
|
133
|
+
* 企业配置信息
|
|
79
134
|
*
|
|
80
|
-
*
|
|
81
|
-
* @return { IRecordPermission } 录制权限
|
|
135
|
+
* 1. 头像配置
|
|
82
136
|
*/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* 获取个人云会议室信息,包含入会密码和个人云会议室号
|
|
86
|
-
*/
|
|
87
|
-
getCloudMeetingRooms(): Promise<void>;
|
|
137
|
+
private setEnterpriseBuffetConfig;
|
|
88
138
|
/**
|
|
89
139
|
* 处理信令下发的等候室
|
|
90
140
|
*
|
|
@@ -93,23 +143,11 @@ declare class Meeting {
|
|
|
93
143
|
*/
|
|
94
144
|
private handleWaitingRoomInfo;
|
|
95
145
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @param { ILayout[] } unAvatarList 需要获取头像的终端
|
|
99
|
-
*/
|
|
100
|
-
handleLayoutAvatar(unAvatarList: ILayout[]): Promise<void>;
|
|
101
|
-
/**
|
|
102
|
-
* 获取企业配置信息
|
|
103
|
-
* 1. 企业管理平台带宽配置
|
|
104
|
-
* 2. Web端请1080P能力
|
|
105
|
-
*/
|
|
106
|
-
setEnterpriseConfig(): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* 根据企业配置媒体能力,得到最终的请流参数
|
|
146
|
+
* 未获取头像的layout
|
|
109
147
|
*
|
|
110
|
-
* @param {
|
|
111
|
-
* @returns {
|
|
148
|
+
* @param { TLayoutMap } layoutListMap
|
|
149
|
+
* @returns { ILayout[] }
|
|
112
150
|
*/
|
|
113
|
-
|
|
151
|
+
private getUnAvatarList;
|
|
114
152
|
}
|
|
115
153
|
export default Meeting;
|
package/lib/main/peer.d.ts
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
-
|
|
24
|
+
peerConnectionStatus: string;
|
|
25
25
|
iceConnectionState: string;
|
|
26
26
|
};
|
|
27
27
|
stream: Stream;
|
|
28
28
|
streamSenders: IStreamSender[];
|
|
29
|
-
|
|
30
|
-
private
|
|
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
|
-
|
|
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
|
-
* 停止呼叫状态检查
|
|
58
|
+
* 停止呼叫状态检查timer
|
|
58
59
|
*
|
|
59
60
|
* @private
|
|
60
61
|
*/
|
|
61
|
-
private
|
|
62
|
+
private stopConnectTimer;
|
|
62
63
|
/**
|
|
63
64
|
* 监听peer连接状态,Timeout:40s
|
|
64
65
|
*
|
|
65
66
|
* @private
|
|
66
67
|
*/
|
|
67
|
-
private
|
|
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内容,设置到
|
|
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 {
|
|
110
|
+
* @param { Object } encodingParams 需要限定的带宽值、帧率值
|
|
110
111
|
* @param { boolean } isIncreaseBase 带宽是否需要✖️系数1000
|
|
111
112
|
*/
|
|
112
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
145
|
+
* Push people and content tracks of stream
|
|
142
146
|
*
|
|
143
147
|
* @public
|
|
144
|
-
* @param { Stream } stream
|
|
145
|
-
* @param {
|
|
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
|
|
148
|
-
reSendContentOffer(): void;
|
|
149
|
-
resetContentStream(contentStreams: IStreamObj[]): void;
|
|
151
|
+
publish(stream: Stream, pushType: PushType): void;
|
|
150
152
|
/**
|
|
151
|
-
*
|
|
153
|
+
* people and content sender status
|
|
152
154
|
*
|
|
153
155
|
* @public
|
|
154
156
|
*/
|
|
155
|
-
|
|
157
|
+
initSenderStatus(): void;
|
|
156
158
|
/**
|
|
157
|
-
*
|
|
159
|
+
* 计算发送/接收端internals统计数据,更新存储到到Layout结果数据中
|
|
160
|
+
* 自动每隔6s记录一次内容统计数据到数据库中
|
|
158
161
|
*
|
|
159
|
-
* @
|
|
162
|
+
* @param { boolean } init - 是否执行初始化操作
|
|
163
|
+
* @private
|
|
160
164
|
*/
|
|
161
|
-
|
|
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
|
|
173
|
+
* Get peerConnection status
|
|
170
174
|
*
|
|
171
175
|
* @public
|
|
172
176
|
*/
|
|
173
177
|
getPeerStatus(): boolean;
|
|
174
178
|
/**
|
|
175
|
-
*
|
|
179
|
+
* Worker回传的结果数据
|
|
176
180
|
*
|
|
177
|
-
* @
|
|
178
|
-
* @param { IStreamObj[] } streamList 流数据
|
|
179
|
-
* @param { 'video' | 'audio' } kind 流类型
|
|
181
|
+
* @param { MessageEvent } event - Worker数据结构
|
|
180
182
|
*/
|
|
181
|
-
|
|
183
|
+
private onMeetingStats;
|
|
182
184
|
/**
|
|
183
|
-
*
|
|
184
|
-
* 自动每隔6s记录一次内容统计数据到数据库中
|
|
185
|
-
*
|
|
186
|
-
* @private
|
|
185
|
+
* 获取基础的视频&音频发送Stats统计数据,通过worker计算返回最终的结果
|
|
187
186
|
*/
|
|
188
|
-
private
|
|
187
|
+
private sendSenderStats;
|
|
189
188
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* @param { IInternels } internels
|
|
193
|
-
* @returns
|
|
189
|
+
* 获取基础的音频Audio接收Stats统计数据,通过worker返回最终的结果
|
|
194
190
|
*/
|
|
195
|
-
private
|
|
191
|
+
private sendAudioReceiverStats;
|
|
196
192
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* @param sum 包的总数
|
|
200
|
-
* @param lost 丢失包的数量
|
|
201
|
-
* @returns 丢包率
|
|
193
|
+
* 获取基础的视频Video接收Stats统计数据,通过worker计算返回最终的结果
|
|
202
194
|
*/
|
|
203
|
-
private
|
|
195
|
+
private sendVideoReceiverStats;
|
|
204
196
|
/**
|
|
205
|
-
*
|
|
197
|
+
* 处理过滤后的StreamConfig数据
|
|
198
|
+
* 1、如果存在Sender,则使用replaceTrack方式替换Track
|
|
199
|
+
* 2、如果不存在Sender,则使用addTransceiver方式协商流通道
|
|
206
200
|
*
|
|
207
|
-
* @
|
|
208
|
-
* @param { IStreamObj[] } streamList 媒体流/协商流列表
|
|
201
|
+
* @param { IStreamConfig[] } streamConfigList 媒体流/协商流列表
|
|
209
202
|
* @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
|
|
210
203
|
*/
|
|
211
|
-
private
|
|
204
|
+
private streamConfigProcessor;
|
|
212
205
|
/**
|
|
213
|
-
*
|
|
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 {
|
|
211
|
+
* @param { IStreamConfig } streamConfig 自定义Stream流配置
|
|
229
212
|
*/
|
|
230
|
-
private
|
|
213
|
+
private addTrackProcessor;
|
|
231
214
|
/**
|
|
232
|
-
*
|
|
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
|
|
240
|
-
/**
|
|
241
|
-
* 替换音频Track轨道
|
|
242
|
-
*
|
|
243
|
-
* @private
|
|
244
|
-
* @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
|
|
245
|
-
*/
|
|
246
|
-
private replaceAudioTrack;
|
|
221
|
+
private setCodecPreferences;
|
|
247
222
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @private
|
|
251
|
-
* @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
|
|
223
|
+
* 缓存浏览器支持所有可用的编解码器配置信息
|
|
252
224
|
*/
|
|
253
|
-
private
|
|
225
|
+
private setSupportCodec;
|
|
254
226
|
/**
|
|
255
|
-
*
|
|
227
|
+
* 替换Sender发送器中的Track数据
|
|
256
228
|
*
|
|
257
|
-
* @
|
|
258
|
-
* @param {
|
|
229
|
+
* @param { MediaStreamTrack } track - MediaStreamTrack数据
|
|
230
|
+
* @param { IStreamConfig } streamConfig - 自定义流配置
|
|
231
|
+
* @param { RTCRtpTransceiverDirection } direction - 通道方向
|
|
259
232
|
*/
|
|
260
|
-
private
|
|
233
|
+
private replaceTrackProcessor;
|
|
261
234
|
/**
|
|
262
|
-
*
|
|
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 {
|
|
285
|
-
* @param {
|
|
286
|
-
* @param {
|
|
287
|
-
* @returns { IReceiver } 接收端的统计数据
|
|
238
|
+
* @param { TCustomStream | MediaStreamTrack } track Track轨道数据
|
|
239
|
+
* @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
|
|
240
|
+
* @param { IStreamConfig } streamConfig 自定义Stream流对象
|
|
288
241
|
*/
|
|
289
|
-
private
|
|
290
|
-
private getReceiverAudioTrackStatus;
|
|
242
|
+
private addTransceiver;
|
|
291
243
|
/**
|
|
292
|
-
*
|
|
244
|
+
* 关联自定义stream对象和Sender发送器数据
|
|
293
245
|
*
|
|
294
246
|
* @private
|
|
295
|
-
* @param {
|
|
296
|
-
* @param {
|
|
297
|
-
* @param {
|
|
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
|
|
251
|
+
private setSenderMap;
|
|
303
252
|
/**
|
|
304
253
|
* 监听远端更新Track事件
|
|
305
254
|
*
|
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
import Client from './client';
|
|
2
|
-
import
|
|
3
|
-
import { IInternels } from '../type';
|
|
2
|
+
import { IConfInfo, IInternals } from '../type';
|
|
4
3
|
declare class QualityManager {
|
|
5
4
|
private client;
|
|
6
|
-
private
|
|
5
|
+
private reportDataTime;
|
|
7
6
|
private meetingQualityData;
|
|
8
|
-
private layoutManager;
|
|
9
7
|
private previousInternals;
|
|
10
8
|
private internals;
|
|
11
9
|
private participantCount;
|
|
12
|
-
|
|
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:
|
|
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
|
-
* @
|
|
56
|
+
* @param { boolean } isImmediate 是否立即上报,默认false, 如果是true,则不对比上一次的level, 直接上报
|
|
37
57
|
*/
|
|
38
|
-
|
|
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;
|