@xylink/xy-rtc-sdk 2.0.1-beta.8 → 2.0.3-beta.11
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/README.MD +56 -22
- package/lib/index.cjs.js +1 -1
- package/lib/index.js +1 -1
- package/lib/src/action/index.d.ts +26 -6
- package/lib/src/enum/errorCode.d.ts +6 -0
- package/lib/src/enum/index.d.ts +77 -118
- package/lib/src/index.d.ts +20 -11
- package/lib/src/main/client.d.ts +429 -91
- package/lib/src/main/deviceManager.d.ts +31 -5
- package/lib/src/main/helper.d.ts +24 -5
- package/lib/src/main/layoutManager.d.ts +100 -45
- package/lib/src/main/peer.d.ts +173 -33
- package/lib/src/main/stream.d.ts +87 -23
- package/lib/src/main/videoManager.d.ts +3 -3
- package/lib/src/tools/browser.d.ts +18 -3
- package/lib/src/tools/config.d.ts +1 -1
- package/lib/src/tools/db.d.ts +1 -1
- package/lib/src/tools/detect.d.ts +6 -0
- package/lib/src/tools/emmitter.d.ts +4 -4
- package/lib/src/tools/enum.d.ts +4 -57
- package/lib/src/tools/httpClient.d.ts +15 -7
- package/lib/src/tools/i18n.d.ts +8 -0
- package/lib/src/tools/index.d.ts +1 -1
- package/lib/src/tools/logger.d.ts +110 -8
- package/lib/src/tools/socket.d.ts +5 -3
- package/lib/src/tools/utils.d.ts +6 -4
- package/lib/src/type/base.d.ts +29 -0
- package/lib/src/type/client.d.ts +923 -0
- package/lib/src/type/device.d.ts +77 -0
- package/lib/src/type/index.d.ts +8 -615
- package/lib/src/type/stream.d.ts +350 -0
- package/package.json +56 -33
- package/lib/src/test/main/client.d.ts +0 -2
|
@@ -6,11 +6,17 @@
|
|
|
6
6
|
* @author jinghui-luo、chengfei
|
|
7
7
|
*
|
|
8
8
|
* Created at : 2020-11-26 14:41:51
|
|
9
|
-
* Last modified : 2021-
|
|
9
|
+
* Last modified : 2021-09-15 16:36:15
|
|
10
10
|
*/
|
|
11
11
|
import Logger from '../tools/logger';
|
|
12
12
|
import Emmitter from '../tools/emmitter';
|
|
13
|
-
import { IDeviceList,
|
|
13
|
+
import { IDeviceList, ISelectedDevice, ICurrentPermission } from '../type';
|
|
14
|
+
/**
|
|
15
|
+
* DeviceManager模块,用于管理枚举设备列表、监听设备变动、处理设备权限等功能
|
|
16
|
+
*
|
|
17
|
+
* @class DeviceManager
|
|
18
|
+
* @extends Emmitter 事件发送器
|
|
19
|
+
*/
|
|
14
20
|
declare class DeviceManager extends Emmitter {
|
|
15
21
|
private navigator;
|
|
16
22
|
private mediaDevices;
|
|
@@ -21,18 +27,23 @@ declare class DeviceManager extends Emmitter {
|
|
|
21
27
|
private permissionCameraStatus;
|
|
22
28
|
private permissionPhoneStatus;
|
|
23
29
|
logger: Logger;
|
|
24
|
-
constructor(logger
|
|
30
|
+
constructor(logger?: Logger);
|
|
25
31
|
/**
|
|
26
32
|
* 获取设备权限数据
|
|
27
33
|
*/
|
|
28
34
|
getDevicePermission(): ICurrentPermission;
|
|
35
|
+
/**
|
|
36
|
+
* 获取当前设备列表
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
getNextDeviceList(): IDeviceList;
|
|
29
40
|
/**
|
|
30
41
|
* 设置当前正在使用的设备信息
|
|
31
42
|
* 1. 此信息可能从stream中获取
|
|
32
43
|
*
|
|
33
44
|
* @param devices 设备数据
|
|
34
45
|
*/
|
|
35
|
-
setCurrentUsedDevice(devices:
|
|
46
|
+
setCurrentUsedDevice(devices: ISelectedDevice): void;
|
|
36
47
|
/**
|
|
37
48
|
* 设置当前正在使用的设备信息
|
|
38
49
|
* 切换设备时,需重新设置此值,为下次diffDevice 使用
|
|
@@ -59,10 +70,18 @@ declare class DeviceManager extends Emmitter {
|
|
|
59
70
|
* 销毁设备管理器实例
|
|
60
71
|
*/
|
|
61
72
|
destroy(): void;
|
|
73
|
+
/**
|
|
74
|
+
* 获取设备列表
|
|
75
|
+
*
|
|
76
|
+
* @private
|
|
77
|
+
* @returns { IDeviceList } list
|
|
78
|
+
*/
|
|
79
|
+
private getPrivateDevices;
|
|
62
80
|
/**
|
|
63
81
|
* 获取设备列表数据
|
|
64
82
|
*/
|
|
65
83
|
getDevices(): Promise<IDeviceList>;
|
|
84
|
+
setPermission(permission: ICurrentPermission): void;
|
|
66
85
|
/**
|
|
67
86
|
* 【私有方法】
|
|
68
87
|
* 向外提供权限信息
|
|
@@ -81,7 +100,14 @@ declare class DeviceManager extends Emmitter {
|
|
|
81
100
|
*
|
|
82
101
|
* @param e 回调权限数据
|
|
83
102
|
*/
|
|
84
|
-
private
|
|
103
|
+
private handlePermissionCameraStateChanged;
|
|
104
|
+
/**
|
|
105
|
+
* 【私有方法】
|
|
106
|
+
* 监听权限变更
|
|
107
|
+
*
|
|
108
|
+
* @param e 回调权限数据
|
|
109
|
+
*/
|
|
110
|
+
private handlePermissionPhoneStateChanged;
|
|
85
111
|
/**
|
|
86
112
|
* 获取摄像头和麦克风权限方法,初始化时直接调用
|
|
87
113
|
*
|
package/lib/src/main/helper.d.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @email luojinghui424@gmail.com
|
|
6
6
|
*
|
|
7
7
|
* Created at : 2021-01-09 14:45:46
|
|
8
|
-
* Last modified : 2021-
|
|
8
|
+
* Last modified : 2021-10-12 15:46:20
|
|
9
9
|
*/
|
|
10
|
-
import { ILayout,
|
|
11
|
-
export declare const getLayoutItemState: (item: ILayout |
|
|
10
|
+
import { ILayout, IVideoManagerState, IRotationInfoTotalItem } from '../type';
|
|
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
13
|
* Get video real display size and roatate of transform infos
|
|
14
14
|
* @param width video real width of reslution
|
|
@@ -18,8 +18,8 @@ export declare const getLayoutItemState: (item: ILayout | ICustomLayoutObj, stre
|
|
|
18
18
|
* @param rotate video real ratio
|
|
19
19
|
*/
|
|
20
20
|
export declare const getVideoInfoByRotaion: (width: number, height: number, containerHeight: number, containerWidth: number, rotate: number) => {
|
|
21
|
-
realWidth:
|
|
22
|
-
realHeight:
|
|
21
|
+
realWidth: number;
|
|
22
|
+
realHeight: number;
|
|
23
23
|
realRotate: number;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
@@ -30,3 +30,22 @@ export declare const getVideoInfoByRotaion: (width: number, height: number, cont
|
|
|
30
30
|
* @param containerHeight 当前参会者画面容器的高度
|
|
31
31
|
*/
|
|
32
32
|
export declare const getLayoutRotateInfo: (item: IRotationInfoTotalItem, containerWidth: number, containerHeight: number) => {};
|
|
33
|
+
/**
|
|
34
|
+
* 获取可支持的编解码
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
* @returns { Promise<Object> }
|
|
38
|
+
*/
|
|
39
|
+
export declare const getSendSupportedCodec: () => Object;
|
|
40
|
+
/**
|
|
41
|
+
* WebRTC 内外网探测
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
* @returns { Promise<Object> }
|
|
45
|
+
*/
|
|
46
|
+
export declare const detectLocator: ({ extId, clientId, clientSecret, httpServer }: {
|
|
47
|
+
extId: string;
|
|
48
|
+
clientId: string;
|
|
49
|
+
clientSecret: string;
|
|
50
|
+
httpServer?: string | undefined;
|
|
51
|
+
}) => Promise<string>;
|
|
@@ -6,63 +6,78 @@
|
|
|
6
6
|
* @email luojinghui424@gmail.com
|
|
7
7
|
*
|
|
8
8
|
* Created at : 2021-01-05 17:24:07
|
|
9
|
-
* Last modified : 2021-
|
|
9
|
+
* Last modified : 2021-10-18 16:03:49
|
|
10
10
|
*/
|
|
11
11
|
import Logger from '../tools/logger';
|
|
12
|
-
import {
|
|
12
|
+
import { ILayout, IVideoRenders, IRoster, ITemplateObj, IScreenInfo, IMode, IOutputCustomLayout, ILayoutRoster, IResolutionType, IConfInfo, IPageInfo, IReqInfo, IQualityType, ICustomLayout } from '../type/index';
|
|
13
13
|
import Client from './client';
|
|
14
14
|
export default class LayoutManager {
|
|
15
15
|
logger: Logger;
|
|
16
16
|
client: Client;
|
|
17
|
+
customLayoutList: Map<string, ILayout>;
|
|
18
|
+
layoutList: Map<string, ILayout>;
|
|
17
19
|
private videoManagers;
|
|
18
|
-
|
|
19
|
-
layoutList: Map<string, ICustomLayoutObj>;
|
|
20
|
+
private originOrderRosters;
|
|
20
21
|
private orderRosterList;
|
|
21
22
|
private selfRoster;
|
|
22
23
|
private newLayoutList;
|
|
23
24
|
private initLayout;
|
|
24
25
|
private templateMode;
|
|
26
|
+
private templateModeTemp;
|
|
25
27
|
private templateRate;
|
|
26
28
|
private specifyTemplateMode;
|
|
27
29
|
private content;
|
|
28
30
|
private screenInfo;
|
|
29
31
|
private internelsLayout;
|
|
30
32
|
private forceFullScreenId;
|
|
31
|
-
private
|
|
33
|
+
private localContent;
|
|
34
|
+
private preConfInfo;
|
|
35
|
+
private confInfo;
|
|
36
|
+
private pageInfo;
|
|
37
|
+
private isLocalShareContent;
|
|
32
38
|
constructor(client: Client);
|
|
33
|
-
static getCustomLayoutItem(item:
|
|
34
|
-
pid:
|
|
35
|
-
resolution:
|
|
36
|
-
quality:
|
|
39
|
+
static getCustomLayoutItem(item: ILayout, resolution: IResolutionType, quality: IQualityType): {
|
|
40
|
+
pid: number;
|
|
41
|
+
resolution: IResolutionType;
|
|
42
|
+
quality: IQualityType;
|
|
37
43
|
mediagroupid: number;
|
|
38
44
|
};
|
|
39
45
|
getNewLayout(): ILayout[];
|
|
40
46
|
getOrderRosterList(): IRoster[];
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
getOriginOrderRosters(): IRoster[];
|
|
48
|
+
getLayoutList(): Map<string, ILayout>;
|
|
49
|
+
getCustomLayoutList(): Map<string, ILayout>;
|
|
43
50
|
getTemplateRate(): {
|
|
44
51
|
previous: number;
|
|
45
52
|
next: number;
|
|
46
53
|
};
|
|
47
|
-
getContentRosterItem(): IRoster;
|
|
48
|
-
getSelfRoster():
|
|
54
|
+
getContentRosterItem(): IRoster | null;
|
|
55
|
+
getSelfRoster(): IRoster;
|
|
49
56
|
getScreenInfo(): IScreenInfo;
|
|
50
57
|
getVideoManagers(): IVideoRenders;
|
|
51
58
|
getForceFullScreenId(): string;
|
|
52
59
|
getTemplateMode(): IMode;
|
|
53
|
-
|
|
54
|
-
rosterRecvMode(orderRosterListLen: any): {
|
|
55
|
-
tempLayout: any[];
|
|
56
|
-
templateRate: number;
|
|
57
|
-
};
|
|
60
|
+
getConfInfo(): IConfInfo;
|
|
58
61
|
getInternelsLayout(): IOutputCustomLayout;
|
|
59
62
|
setOrderRosterList(orderRosterList: IRoster[]): void;
|
|
63
|
+
setOriginOrderRosters(originOrderRosters: IRoster[]): void;
|
|
64
|
+
setForceFullScreenId(id?: string): void;
|
|
65
|
+
setTemplateMode(templateMode: IMode): void;
|
|
66
|
+
setContentRosterItem(content: IRoster): void;
|
|
67
|
+
setConfInfo(confInfo: IConfInfo): void;
|
|
68
|
+
setLocalShareContent(is: boolean): void;
|
|
69
|
+
rosterRecvMode(orderRosterListLen: number): {
|
|
70
|
+
tempLayout: ITemplateObj[];
|
|
71
|
+
templateRate: number;
|
|
72
|
+
};
|
|
60
73
|
initLayoutManager(): void;
|
|
61
74
|
/**
|
|
62
75
|
* 回调 video 状态
|
|
63
76
|
*
|
|
64
77
|
* @param key endpointId + mediagroupId 组成的id
|
|
65
|
-
* @param data 最新的会议状态
|
|
78
|
+
* @param data 最新的会议状态 status === video track / video标签 监听到的状态
|
|
79
|
+
*
|
|
80
|
+
* state === roster 当前状态 + 上一次的status
|
|
66
81
|
*/
|
|
67
82
|
private onVideoStatusChange;
|
|
68
83
|
/**
|
|
@@ -71,7 +86,9 @@ export default class LayoutManager {
|
|
|
71
86
|
* @param key endpointId + mediagroupId 组成的id
|
|
72
87
|
* @param wrapEleId wrap video element id
|
|
73
88
|
*/
|
|
74
|
-
setVideoRenderer(key:
|
|
89
|
+
setVideoRenderer(key: string, wrapEleId: string): void;
|
|
90
|
+
playVideo(keys?: string[]): Promise<void>;
|
|
91
|
+
updateLocalTrack(): void;
|
|
75
92
|
/**
|
|
76
93
|
* 使用最新的 videoTrackList 和 layoutResults 数据更新 layout 内容
|
|
77
94
|
*/
|
|
@@ -80,27 +97,84 @@ export default class LayoutManager {
|
|
|
80
97
|
* 清理失效的 video manager 数据
|
|
81
98
|
*/
|
|
82
99
|
clearInvalidVideoManagers(): void;
|
|
100
|
+
/**
|
|
101
|
+
* 重新计算页码信息
|
|
102
|
+
*/
|
|
103
|
+
calcPageInfo(): void;
|
|
104
|
+
/**
|
|
105
|
+
* AUTO布局 分页
|
|
106
|
+
* @param currentPage 请求某一页数据
|
|
107
|
+
*/
|
|
108
|
+
setPageInfo(currentPage?: number): void;
|
|
109
|
+
/**
|
|
110
|
+
* 全屏请流
|
|
111
|
+
*/
|
|
112
|
+
calcForceFullScreenRequestLayout(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* AUTO布局 请流
|
|
115
|
+
*/
|
|
116
|
+
calcRequestNewLayout(pageInfo?: IPageInfo): void;
|
|
117
|
+
/**
|
|
118
|
+
* AUTO : 基于 new layout result 消息生成 customLayoutList 数据,并diff对比更新数据
|
|
119
|
+
* @param totalLayoutResultList
|
|
120
|
+
*/
|
|
121
|
+
createAutoLayout(totalLayoutResultList: ILayoutRoster[]): void;
|
|
122
|
+
/**
|
|
123
|
+
* 创建排好序的roster数据
|
|
124
|
+
*
|
|
125
|
+
* @param totalLayoutResultList
|
|
126
|
+
*/
|
|
127
|
+
private createOrderRoster;
|
|
83
128
|
createCustomLayout(totalLayoutResultList: ILayoutRoster[]): void;
|
|
84
129
|
/**
|
|
85
130
|
* 根据 reqList 计算最新的 layout 数据
|
|
86
131
|
*
|
|
87
132
|
* @param reqList
|
|
88
133
|
*/
|
|
89
|
-
requestLayout(reqList:
|
|
134
|
+
requestLayout(reqList: IReqInfo[]): void;
|
|
135
|
+
calculatePosition(): void;
|
|
136
|
+
calculateRotate(): void;
|
|
137
|
+
requestLayoutCalculator(): ICustomLayout[];
|
|
138
|
+
getVideoStreamByTrackId(videoTrackId: string): {
|
|
139
|
+
videoStream: MediaStream | null;
|
|
140
|
+
track: MediaStreamTrack | null;
|
|
141
|
+
};
|
|
142
|
+
calculateNewLayoutList(): {
|
|
143
|
+
roster: IRoster;
|
|
144
|
+
position: number[];
|
|
145
|
+
resolution: 2 | 1 | 3 | 4 | 5;
|
|
146
|
+
zIndex: number;
|
|
147
|
+
}[];
|
|
148
|
+
calculateScreenInfo(): {
|
|
149
|
+
width: number;
|
|
150
|
+
height: number;
|
|
151
|
+
rateHeight: number;
|
|
152
|
+
rateWidth: number;
|
|
153
|
+
};
|
|
154
|
+
requestCustomLayout(): void;
|
|
155
|
+
createLayout(): void;
|
|
156
|
+
calculateOrderRosterList(): IRoster[];
|
|
157
|
+
switchLayout(templateMode?: IMode): IMode | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* 【内部方法】停止轮询时,清理无效的 videoManager 数据
|
|
160
|
+
*
|
|
161
|
+
* @param monitoryList callUri list 数据
|
|
162
|
+
*/
|
|
163
|
+
clearVideoManagersUseMonitorList(monitoryList: string[]): void;
|
|
164
|
+
/**
|
|
165
|
+
* 维护 Local roster 状态
|
|
166
|
+
* @param data
|
|
167
|
+
*/
|
|
168
|
+
setLocalStatus(data: any): void;
|
|
90
169
|
/**
|
|
91
170
|
* 清理无效的 layout 数据,重置状态
|
|
92
171
|
*/
|
|
93
172
|
private clearInvalidLayout;
|
|
94
173
|
private createBaseLayout;
|
|
95
|
-
calculatePosition(): void;
|
|
96
|
-
requestLayoutCalculator(): any[];
|
|
97
|
-
setForceFullScreenId(id: string): void;
|
|
98
174
|
/**
|
|
99
175
|
* 计算 custom layout 数据
|
|
100
176
|
*/
|
|
101
177
|
private customLayoutCalculator;
|
|
102
|
-
calculateRotate(): void;
|
|
103
|
-
customNewLayoutReq(data: any): void;
|
|
104
178
|
/**
|
|
105
179
|
* 通过旋转信息获取在layout中的位置
|
|
106
180
|
*
|
|
@@ -109,23 +183,4 @@ export default class LayoutManager {
|
|
|
109
183
|
*/
|
|
110
184
|
private getLayoutKeyByRotateInfo;
|
|
111
185
|
private localMirrorRotate;
|
|
112
|
-
getVideoStreamByTrackId(videoTrackId: string): {
|
|
113
|
-
videoStream: any;
|
|
114
|
-
track: any;
|
|
115
|
-
};
|
|
116
|
-
calculateNewLayoutList(): any[];
|
|
117
|
-
calculateScreenInfo(): {
|
|
118
|
-
width: number;
|
|
119
|
-
height: number;
|
|
120
|
-
rateHeight: number;
|
|
121
|
-
rateWidth: number;
|
|
122
|
-
};
|
|
123
|
-
requestCustomLayout(): void;
|
|
124
|
-
createLayout(): void;
|
|
125
|
-
calculateOrderRosterList(): any;
|
|
126
|
-
switchLayout(templateMode: IMode): IMode;
|
|
127
|
-
setTemplateMode(templateMode: IMode): void;
|
|
128
|
-
setChairmanRoster(roster: IRoster): void;
|
|
129
|
-
setContentRosterItem(content: IRoster): void;
|
|
130
|
-
private setSelfRoster;
|
|
131
186
|
}
|
package/lib/src/main/peer.d.ts
CHANGED
|
@@ -4,20 +4,21 @@
|
|
|
4
4
|
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
5
|
* @date 2019-10-25 18:53:01
|
|
6
6
|
*/
|
|
7
|
-
import { IInvite, IStreamSender, IPushType } from '../type';
|
|
7
|
+
import { IInvite, IStreamObj, IStreamSender, IInternels, IPushType, ICandidate } from '../type';
|
|
8
8
|
import Client from './client';
|
|
9
9
|
import Logger from '../tools/logger';
|
|
10
10
|
import Stream from './stream';
|
|
11
|
+
/**
|
|
12
|
+
* Peer模块,用于管理 P2P 连接和内部事件
|
|
13
|
+
*
|
|
14
|
+
* @class Peer
|
|
15
|
+
*/
|
|
11
16
|
export default class Peer {
|
|
12
17
|
private connectTimmer;
|
|
13
18
|
private connectCount;
|
|
14
19
|
client: Client;
|
|
15
|
-
peerConnection:
|
|
20
|
+
peerConnection: RTCPeerConnection | null;
|
|
16
21
|
logger: Logger;
|
|
17
|
-
streams: {
|
|
18
|
-
localStream: MediaStream;
|
|
19
|
-
streams: MediaStream[];
|
|
20
|
-
};
|
|
21
22
|
invite: IInvite;
|
|
22
23
|
peerStatus: {
|
|
23
24
|
peerconnectionStatus: string;
|
|
@@ -30,94 +31,233 @@ export default class Peer {
|
|
|
30
31
|
private isShareContent;
|
|
31
32
|
private senderInterval;
|
|
32
33
|
constructor(client: Client, stream: Stream);
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
getInternels(): IInternels;
|
|
35
|
+
/**
|
|
36
|
+
* 初始化Peer模块
|
|
37
|
+
* 1. 创建PeerConnection
|
|
38
|
+
* 2. 初始化监听事件
|
|
39
|
+
*
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
private init;
|
|
43
|
+
/**
|
|
44
|
+
* 向client发送呼叫状态
|
|
45
|
+
*
|
|
46
|
+
* @private
|
|
47
|
+
* @param { string } type 消息Key
|
|
48
|
+
* @param { number } code 状态码
|
|
49
|
+
* @param { string } msg 消息内容
|
|
50
|
+
* @param { any } detail 消息数据
|
|
51
|
+
*/
|
|
52
|
+
private sendEmmit;
|
|
53
|
+
/**
|
|
54
|
+
* 停止呼叫状态检查timmer
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
35
58
|
private stopConnectTimmer;
|
|
59
|
+
/**
|
|
60
|
+
* 监听peer连接状态,Timeout:40s
|
|
61
|
+
*
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
36
64
|
private initTimmer;
|
|
37
|
-
|
|
65
|
+
/**
|
|
66
|
+
* ice协商回调事件
|
|
67
|
+
*
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
private onHandleNegotiationNeeded;
|
|
38
71
|
/**
|
|
39
72
|
* 创建offer,并针对stream设置初始带宽
|
|
40
|
-
*
|
|
73
|
+
*
|
|
74
|
+
* @private
|
|
75
|
+
* @param { RTCOfferOptions } options createOffer options
|
|
41
76
|
* @param isSetBandwidth 是否设置初始带宽,180:100,360: 500, 720: 1000
|
|
42
77
|
*/
|
|
43
|
-
createBaseOfferConnection
|
|
44
|
-
private sendSocketMessage;
|
|
78
|
+
private createBaseOfferConnection;
|
|
45
79
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
80
|
+
* 通过client模块统一发送socket消息
|
|
81
|
+
*
|
|
82
|
+
* @public
|
|
83
|
+
* @param { string } type 消息key
|
|
84
|
+
* @param { any } data 消息内容
|
|
85
|
+
*/
|
|
86
|
+
sendSocketMessage(type: string, data: any): void;
|
|
87
|
+
/**
|
|
88
|
+
* 处理candidate消息
|
|
89
|
+
*
|
|
90
|
+
* @public
|
|
91
|
+
* @param { ICandidate } body candidate消息内容
|
|
48
92
|
*/
|
|
49
|
-
handleCandidate(body:
|
|
93
|
+
handleCandidate(body: ICandidate): Promise<void>;
|
|
50
94
|
/**
|
|
51
95
|
* 响应offer
|
|
52
|
-
*
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
* @param { RTCSessionDescriptionInit } answer answerSDP内容,设置到peerconnection上
|
|
99
|
+
*/
|
|
100
|
+
handleAnswer(answer: RTCSessionDescriptionInit): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* 对Track轨道进行动态带宽调整
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
* @param { string } trackId Track轨道id
|
|
106
|
+
* @param { number } bandwidth 需要限定的带宽值
|
|
107
|
+
* @param { boolean } isIncreaseBase 带宽是否需要✖️系数1000
|
|
53
108
|
*/
|
|
54
|
-
handleAnswer(answer: any): Promise<void>;
|
|
55
109
|
setBandWidth(trackId: string, bandwidth?: number, isIncreaseBase?: boolean): Promise<void>;
|
|
56
110
|
/**
|
|
57
111
|
* View the cb of ice connectionn status change
|
|
58
112
|
* Maybe status:'new', 'checking', 'connected', 'completed', 'failed', 'disconnected', 'closed'
|
|
59
113
|
*
|
|
60
|
-
* @
|
|
114
|
+
* @private
|
|
115
|
+
* @param { Event } e ice连接回调状态事件
|
|
116
|
+
*/
|
|
117
|
+
private onHandleIceConnectionStateChange;
|
|
118
|
+
/**
|
|
119
|
+
* peerconnection connect status change cb, only supports Chrome 72 or higher
|
|
120
|
+
* pc.connectionState: connected,disconnected,failed,closed,connecting,new
|
|
121
|
+
*
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
private onHandleConnectionStateChange;
|
|
125
|
+
onHandleIcecandidateerror(e: Event): void;
|
|
126
|
+
/**
|
|
127
|
+
* 重连PeerConnection
|
|
128
|
+
*
|
|
129
|
+
* @public
|
|
61
130
|
*/
|
|
62
|
-
onHandleIceConnectionStateChange(e: any): void;
|
|
63
|
-
onHandleConnectionStateChange(): Promise<void>;
|
|
64
131
|
restartIceConnection(): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* 关闭PeerConnection连接、销毁状态
|
|
134
|
+
*/
|
|
65
135
|
close(): void;
|
|
66
136
|
/**
|
|
67
137
|
* add Track for stream, default push all
|
|
68
138
|
*
|
|
69
|
-
* @
|
|
70
|
-
* @param
|
|
139
|
+
* @public
|
|
140
|
+
* @param { Stream } stream Local stream
|
|
141
|
+
* @param { IPushType } pushType 推送类型,all全推送,video只推送video,audio只推送audio, content只推送content video流
|
|
71
142
|
*/
|
|
72
143
|
publish(stream: Stream, pushType?: IPushType): void;
|
|
144
|
+
/**
|
|
145
|
+
* 替换People Video Track轨道
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
73
149
|
replacePeopleVideoTrack(stream: Stream, kind?: string): void;
|
|
74
150
|
/**
|
|
75
151
|
* people and content sender status
|
|
152
|
+
*
|
|
153
|
+
* @public
|
|
76
154
|
*/
|
|
77
155
|
initSenderStatus(): void;
|
|
78
156
|
/**
|
|
79
157
|
* Reset content serder track
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
80
160
|
*/
|
|
81
161
|
closeContentStream(): void;
|
|
82
162
|
/**
|
|
83
163
|
* Get peerconnection status
|
|
164
|
+
*
|
|
165
|
+
* @public
|
|
84
166
|
*/
|
|
85
167
|
getPeerStatus(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* 无流切换至有流,需向transceiver重新setStream/replaceTrack
|
|
170
|
+
*
|
|
171
|
+
* @public
|
|
172
|
+
* @param { IStreamObj[] } streamList 流数据
|
|
173
|
+
* @param { 'video' | 'audio' } kind 流类型
|
|
174
|
+
*/
|
|
175
|
+
setStream(streamList: IStreamObj[], kind: 'video' | 'audio'): void;
|
|
176
|
+
/**
|
|
177
|
+
* 计算发送/接收端internels统计数据,更新存储到到Layout结果数据中
|
|
178
|
+
* 自动每隔6s记录一次内容统计数据到数据库中
|
|
179
|
+
*
|
|
180
|
+
* @private
|
|
181
|
+
*/
|
|
86
182
|
private calcMeetingStats;
|
|
87
183
|
/**
|
|
88
|
-
*
|
|
184
|
+
* 批量向peer通道添加Track轨道数据
|
|
89
185
|
*
|
|
90
|
-
* @
|
|
186
|
+
* @private
|
|
187
|
+
* @param { IStreamObj[] } streamList 媒体流/协商流列表
|
|
188
|
+
* @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
|
|
91
189
|
*/
|
|
92
190
|
private addTransceiver;
|
|
191
|
+
/**
|
|
192
|
+
* 向peer添加Track轨道数据
|
|
193
|
+
*
|
|
194
|
+
* @private
|
|
195
|
+
* @param { TCustomStream | MediaStreamTrack } track Track轨道数据
|
|
196
|
+
* @param { RTCRtpTransceiverDirection } direction 指定添加到peer上的方向
|
|
197
|
+
* @param { IStreamObj } item 自定义Stream流对象
|
|
198
|
+
*/
|
|
93
199
|
private addStreamRenders;
|
|
94
200
|
/**
|
|
95
|
-
*
|
|
201
|
+
* 关联自定义stream对象和Sender发送器数据
|
|
202
|
+
*
|
|
203
|
+
* @private
|
|
204
|
+
* @param { TCustomStream | MediaStreamTrack } track Track轨道数据
|
|
205
|
+
* @param { IStreamObj } item 自定义Stream流对象
|
|
206
|
+
* @param { RTCRtpTransceiver } rtcRtpTransceiver 流的发送器,由向peer添加track生成
|
|
207
|
+
*/
|
|
208
|
+
private setStreamSenders;
|
|
209
|
+
/**
|
|
210
|
+
* 替换音频Track轨道
|
|
96
211
|
*
|
|
97
|
-
* @
|
|
212
|
+
* @private
|
|
213
|
+
* @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
|
|
98
214
|
*/
|
|
99
215
|
private replaceAudioTrack;
|
|
100
216
|
/**
|
|
101
217
|
* Replace Track
|
|
102
218
|
*
|
|
103
|
-
* @
|
|
219
|
+
* @private
|
|
220
|
+
* @param { IStreamObj[] } streamList 自定义媒体流对象列表数据
|
|
104
221
|
*/
|
|
105
222
|
private replaceTrack;
|
|
223
|
+
/**
|
|
224
|
+
* 获取sender的发送数据
|
|
225
|
+
*
|
|
226
|
+
* @private
|
|
227
|
+
* @param { RTCStatsReport } stats sender发送器的统计数据
|
|
228
|
+
* @param { IInternels } internels 自定义internels统计数据
|
|
229
|
+
* @param { IStreamSender } senderItem sender发送器对象
|
|
230
|
+
* @param { boolean } firstMatch match第一次数据,记录一些通用数据
|
|
231
|
+
* @returns { ISender } 自定义统计数据内容
|
|
232
|
+
*/
|
|
106
233
|
private getSenderStatus;
|
|
234
|
+
/**
|
|
235
|
+
* 获取receiver的数据
|
|
236
|
+
*
|
|
237
|
+
* @private
|
|
238
|
+
* @param { RTCStatsReport } stats sender发送器的统计数据
|
|
239
|
+
* @param { ILayout } layoutItem layout布局数据
|
|
240
|
+
* @returns { IReceiver } 接收端的统计数据
|
|
241
|
+
*/
|
|
107
242
|
private getReceiverStatus;
|
|
108
243
|
/**
|
|
109
244
|
* 计算速率
|
|
110
245
|
*
|
|
111
|
-
* @
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
246
|
+
* @private
|
|
247
|
+
* @param { any } report 上一次report总值
|
|
248
|
+
* @param { string } accumulativeMetric key
|
|
249
|
+
* @param { string } samplesMetric timeLong
|
|
250
|
+
* @param { number } bitsRate bite转换值
|
|
251
|
+
* @param { number } timeRatio 事件单位
|
|
252
|
+
* @param { any } dataOrigin 上一次的数据
|
|
117
253
|
*/
|
|
118
254
|
private rateBytesCalculator;
|
|
119
255
|
/**
|
|
120
256
|
* 监听远端更新Track事件
|
|
257
|
+
*
|
|
258
|
+
* @private
|
|
259
|
+
* @event
|
|
260
|
+
* @param { RTCTrackEvent } e peer回调track数据
|
|
121
261
|
*/
|
|
122
262
|
private onTrack;
|
|
123
263
|
}
|