@xylink/xy-rtc-sdk 3.9.11-private.6 → 4.0.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.
- package/README.MD +36 -13
- package/lib/action/index.d.ts +106 -36
- package/lib/enum/analyser.d.ts +7 -0
- package/lib/enum/client.d.ts +8 -2
- package/lib/enum/constraints.d.ts +51 -0
- package/lib/enum/device.d.ts +28 -0
- package/lib/enum/errorCode.d.ts +8 -2
- package/lib/enum/i18n.d.ts +6 -0
- package/lib/enum/index.d.ts +90 -7
- package/lib/enum/meeting.d.ts +4 -0
- package/lib/enum/polling.d.ts +2 -11
- package/lib/feature/customMessage/index.d.ts +29 -0
- package/lib/feature/edu/index.d.ts +34 -0
- package/lib/feature/edu/index.type.d.ts +29 -0
- package/lib/feature/index.d.ts +3 -0
- package/lib/feature/speaker/index.d.ts +81 -0
- package/lib/feature/speaker/index.type.d.ts +17 -0
- package/lib/index.d.ts +84 -31
- package/lib/interface/baseModule.type.d.ts +9 -0
- package/lib/interface/clientInterface.type.d.ts +128 -0
- package/lib/interface/contentTrackInterface.type.d.ts +15 -0
- package/lib/interface/event.type.d.ts +444 -0
- package/lib/interface/videoAudioTrackInterface.type.d.ts +17 -0
- package/lib/main/ability/const.d.ts +5 -0
- package/lib/main/ability/index.d.ts +37 -0
- package/lib/main/{iauth.d.ts → auth/index.d.ts} +34 -26
- package/lib/main/client.d.ts +643 -637
- package/lib/main/clientBase.d.ts +40 -0
- package/lib/main/clientState.d.ts +56 -0
- package/lib/main/device/index.d.ts +272 -0
- package/lib/main/device/index.type.d.ts +204 -0
- package/lib/main/helper/index.d.ts +118 -0
- package/lib/main/helper/index.type.d.ts +12 -0
- package/lib/main/layout/index.d.ts +74 -108
- package/lib/main/layout/index.type.d.ts +282 -0
- package/lib/main/layout/polling.d.ts +17 -13
- package/lib/main/layout/state.d.ts +163 -0
- package/lib/main/layout/template.d.ts +3 -3
- package/lib/main/media/index.d.ts +177 -0
- package/lib/main/media/index.type.d.ts +29 -0
- package/lib/main/meeting/control.d.ts +107 -0
- package/lib/main/meeting/control.type.d.ts +24 -0
- package/lib/main/{meeting.d.ts → meeting/index.d.ts} +58 -28
- package/lib/main/meeting/verify.d.ts +70 -0
- package/lib/main/meeting/verify.type.d.ts +12 -0
- package/lib/main/peer.d.ts +67 -19
- package/lib/main/plugin/index.d.ts +28 -0
- package/lib/{tools/quality.d.ts → main/quality/index.d.ts} +2 -2
- package/lib/{tools → main/quality}/quality.worker.d.ts +1 -1
- package/lib/main/{qualityManager.d.ts → quality/report.d.ts} +11 -5
- package/lib/main/render/index.d.ts +116 -0
- package/lib/main/render/index.type.d.ts +36 -0
- package/lib/main/render/videoManager.d.ts +190 -0
- package/lib/main/render/videoManager.type.d.ts +66 -0
- package/lib/main/roster/index.d.ts +39 -0
- package/lib/main/server/index.d.ts +79 -0
- package/lib/main/server/index.type.d.ts +21 -0
- package/lib/main/signal/index.d.ts +15 -0
- package/lib/main/socket/index.d.ts +95 -0
- package/lib/main/stream/index.d.ts +182 -0
- package/lib/main/track/baseTrack.d.ts +178 -0
- package/lib/main/track/contentTrack.d.ts +168 -0
- package/lib/main/track/customContentTrack.d.ts +18 -0
- package/lib/main/track/customVideoAudioTrack.d.ts +18 -0
- package/lib/main/track/helper.d.ts +53 -0
- package/lib/main/track/videoAudioCapture.d.ts +90 -0
- package/lib/main/track/videoAudioTrack.d.ts +273 -0
- package/lib/main/vom/index.d.ts +44 -0
- package/lib/main/vom/index.type.d.ts +1 -0
- package/lib/tools/analyser.d.ts +53 -0
- package/lib/tools/analyserManager.d.ts +55 -0
- package/lib/tools/dbManager.d.ts +12 -1
- package/lib/tools/{browser.d.ts → detectBrowser/index.d.ts} +53 -5
- package/lib/tools/detectStream/index.d.ts +84 -0
- package/lib/tools/detectStream/index.type.d.ts +56 -0
- package/lib/tools/detectTool/index.d.ts +191 -0
- package/lib/tools/detectTool/index.type.d.ts +51 -0
- package/lib/tools/emitter.d.ts +27 -6
- package/lib/tools/enum.d.ts +1 -1
- package/lib/tools/httpClient.d.ts +23 -6
- package/lib/tools/i18n.d.ts +1 -1
- package/lib/tools/index.d.ts +5 -5
- package/lib/tools/{logger.d.ts → log/logger.d.ts} +59 -29
- package/lib/tools/{logger.worker.d.ts → log/logger.worker.d.ts} +1 -1
- package/lib/tools/log/loggerManager.d.ts +70 -0
- package/lib/tools/pressure/index.d.ts +33 -0
- package/lib/tools/pressure/index.type.d.ts +22 -0
- package/lib/tools/promiseQueue.d.ts +51 -0
- package/lib/tools/queue.d.ts +12 -15
- package/lib/tools/resize.d.ts +65 -0
- package/lib/tools/snapshot.d.ts +31 -0
- package/lib/tools/socket.d.ts +109 -32
- package/lib/tools/template/index.d.ts +3 -3
- package/lib/tools/template/mobile.d.ts +1 -1
- package/lib/tools/template/polling.d.ts +1 -1
- package/lib/tools/utils.d.ts +22 -19
- package/lib/tools/verify.d.ts +7 -0
- package/lib/type/ability.d.ts +25 -0
- package/lib/type/analyser.d.ts +43 -0
- package/lib/type/{iauth.d.ts → auth.d.ts} +22 -29
- package/lib/type/base.d.ts +41 -33
- package/lib/type/capture.d.ts +9 -0
- package/lib/type/client.d.ts +404 -498
- package/lib/type/index.d.ts +26 -2
- package/lib/type/layout.d.ts +25 -49
- package/lib/type/logger.d.ts +37 -12
- package/lib/type/meeting.d.ts +266 -27
- package/lib/type/peer.d.ts +24 -1
- package/lib/type/polling.d.ts +1 -49
- package/lib/type/quality.d.ts +16 -6
- package/lib/type/socket.d.ts +42 -0
- package/lib/type/stream.d.ts +154 -116
- package/lib/type/track.d.ts +139 -0
- package/lib/xyrtc.cjs.js +1 -1
- package/lib/xyrtc.umd.js +1 -1
- package/package.json +11 -3
- package/lib/enum/contraints.d.ts +0 -50
- package/lib/main/deviceManager.d.ts +0 -185
- package/lib/main/helper.d.ts +0 -79
- package/lib/main/stream.d.ts +0 -396
- package/lib/main/videoManager.d.ts +0 -57
- package/lib/tools/audioLevel.d.ts +0 -23
- package/lib/tools/detect.d.ts +0 -43
- package/lib/type/device.d.ts +0 -83
package/lib/main/stream.d.ts
DELETED
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XYLink WebRTC Stream Manager Lib
|
|
3
|
-
*
|
|
4
|
-
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
5
|
-
* @date 2019-10-27 23:12:45
|
|
6
|
-
*/
|
|
7
|
-
import Logger from '../tools/logger';
|
|
8
|
-
import Emitter from '../tools/emitter';
|
|
9
|
-
import { IStreamChangeType, IStreamConfig, IGetMediaStreams, ISource, IStreamInitConfig, IStreamCurrent, IStreamChange, IStreamInitParams, StreamKind, CaptureStatus, OperateType, ICreateContentConfig, TDeviceKind } from '../type';
|
|
10
|
-
import Peer from './peer';
|
|
11
|
-
import Client from './client';
|
|
12
|
-
export default class Stream extends Emitter {
|
|
13
|
-
streams: IStreamConfig[];
|
|
14
|
-
initConfig: IStreamInitConfig;
|
|
15
|
-
initParams: IStreamInitParams;
|
|
16
|
-
currentMode: IStreamCurrent;
|
|
17
|
-
private client;
|
|
18
|
-
private audioLevel;
|
|
19
|
-
private logger;
|
|
20
|
-
private previewStreams;
|
|
21
|
-
private pipelineStreams;
|
|
22
|
-
private contentStreams;
|
|
23
|
-
private streamStatus;
|
|
24
|
-
private isShareContent;
|
|
25
|
-
private audioDeviceId;
|
|
26
|
-
private audioOutputDeviceId;
|
|
27
|
-
private videoDeviceId;
|
|
28
|
-
private isFirefox;
|
|
29
|
-
private enabledCapture;
|
|
30
|
-
private screenAudio;
|
|
31
|
-
constructor(params: {
|
|
32
|
-
logger: Logger;
|
|
33
|
-
client?: Client;
|
|
34
|
-
});
|
|
35
|
-
static instance: Stream;
|
|
36
|
-
static getStreamInstance(params: {
|
|
37
|
-
logger: Logger;
|
|
38
|
-
client?: Client;
|
|
39
|
-
}): Stream;
|
|
40
|
-
/**
|
|
41
|
-
* 获取基础的约束配置
|
|
42
|
-
*
|
|
43
|
-
* @param { CaptureStatus } enableVideo - 启用视频状态
|
|
44
|
-
* @param { CaptureStatus } enableAudio - 启用音频状态
|
|
45
|
-
* @param { any } baseMapConstraints - 基础约束配置列表
|
|
46
|
-
* @returns { MediaStreamConstraints } 合并最终的约束配置
|
|
47
|
-
*/
|
|
48
|
-
static getBaseConstraints(enableVideo: CaptureStatus, enableAudio: CaptureStatus, baseMapConstraints?: any): {
|
|
49
|
-
video: any;
|
|
50
|
-
audio: any;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* 获取Video/Audio的兼容性约束配置
|
|
54
|
-
*
|
|
55
|
-
* @param { CaptureStatus } enable - 启用设备状态
|
|
56
|
-
* @param { MediaTrackConstraints } supportConstraints - 浏览器支持的约束配置列表
|
|
57
|
-
* @param { MediaTrackConstraints } baseConstraint - 通过分辨率匹配的默认约束设置
|
|
58
|
-
* @returns { MediaTrackConstraints | boolean }
|
|
59
|
-
*/
|
|
60
|
-
static getCompatibleConstraints(enable: CaptureStatus, supportConstraints: any, baseConstraint: any): any;
|
|
61
|
-
/**
|
|
62
|
-
* 获取浏览器支持的约束配置字段
|
|
63
|
-
*
|
|
64
|
-
* @returns { MediaTrackConstraints } 约束配置列表
|
|
65
|
-
*/
|
|
66
|
-
static getSupportConstraints(): MediaTrackConstraints;
|
|
67
|
-
/**
|
|
68
|
-
* 获取本地预览流
|
|
69
|
-
*
|
|
70
|
-
* @returns { IStreamConfig[] } 本地预览流
|
|
71
|
-
*/
|
|
72
|
-
getLocalStream(): IStreamConfig[];
|
|
73
|
-
getIndexFromStreamChange(stream: MediaStream, streamChangeInfo: IStreamChange[]): number;
|
|
74
|
-
/**
|
|
75
|
-
* stream 取消监听事件
|
|
76
|
-
*
|
|
77
|
-
* @param {string} key
|
|
78
|
-
* @param {function} listener
|
|
79
|
-
*/
|
|
80
|
-
off(key: string): void;
|
|
81
|
-
/**
|
|
82
|
-
* 媒体网关发给WEB JS的视频流的分辨率、带宽信息、帧率
|
|
83
|
-
* WEB收到消息后推送相应视频流/调整带宽
|
|
84
|
-
*
|
|
85
|
-
* @param { IStreamChangeType } body StreamChange消息内容
|
|
86
|
-
* @param { Peer } peer Peer模块
|
|
87
|
-
* @param { number } mediaGroupId 当前stream是否是content画面
|
|
88
|
-
*/
|
|
89
|
-
handleChangeStream(body: IStreamChangeType, peer: Peer, mediaGroupId: number): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* 切换扬声器
|
|
92
|
-
*
|
|
93
|
-
* @param { string } deviceId - 设备id
|
|
94
|
-
*/
|
|
95
|
-
setAudioOutput(deviceId: string): Promise<{
|
|
96
|
-
deviceId: string;
|
|
97
|
-
}>;
|
|
98
|
-
/**
|
|
99
|
-
* 设备麦克风/摄像头切换
|
|
100
|
-
*
|
|
101
|
-
* @param { TDeviceKind } type - 设备类型
|
|
102
|
-
* @param { string } deviceId - 设备ID
|
|
103
|
-
* @returns { Promise<boolean> }
|
|
104
|
-
*/
|
|
105
|
-
switchDevice(type: TDeviceKind, deviceId: string): Promise<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* 重置StreamConfig状态为默认状态
|
|
108
|
-
*
|
|
109
|
-
* @param { StreamKind } type - 需要重置的流类型
|
|
110
|
-
*/
|
|
111
|
-
private resetStreamConfigStatus;
|
|
112
|
-
sendStreamStatus(): void;
|
|
113
|
-
/**
|
|
114
|
-
* 麦克风/摄像头开启/关闭操作
|
|
115
|
-
*
|
|
116
|
-
* @param { OperateType } type - 操作类型
|
|
117
|
-
* @returns
|
|
118
|
-
*/
|
|
119
|
-
operateVideoOrAudio(type: OperateType): Promise<undefined>;
|
|
120
|
-
/**
|
|
121
|
-
* 针对自定义流对应的Track进行启用/停止操作
|
|
122
|
-
*
|
|
123
|
-
* @param { OperateType } type - 操作类型
|
|
124
|
-
* @param { boolean? } stopAudioTrack - 是否需要停止audioTrack
|
|
125
|
-
*/
|
|
126
|
-
private setStreamStatus;
|
|
127
|
-
/**
|
|
128
|
-
* 获取stop的track
|
|
129
|
-
*
|
|
130
|
-
* @param { MediaStreamTrack[] } tracks - track数组
|
|
131
|
-
* @returns
|
|
132
|
-
*/
|
|
133
|
-
private getEndedTrack;
|
|
134
|
-
/**
|
|
135
|
-
* 启用/停止MediaStreamTrack
|
|
136
|
-
*
|
|
137
|
-
* @param { MediaStream } stream - MediaStream流
|
|
138
|
-
* @param { OperateType } type - 操作类型
|
|
139
|
-
* @param { boolean } stopAudioTrack - 是否强制停止audioTrack
|
|
140
|
-
*/
|
|
141
|
-
setStreamTracksStatus(stream: MediaStream, type: OperateType, stopAudioTrack?: boolean): void;
|
|
142
|
-
close(): void;
|
|
143
|
-
private closeStreams;
|
|
144
|
-
getMediaStreams(): IGetMediaStreams;
|
|
145
|
-
/**
|
|
146
|
-
* 初始化视频流-v2
|
|
147
|
-
*
|
|
148
|
-
* @public
|
|
149
|
-
* @param { IStreamInitConfig } config 输入输出设备相关配置,默认是{}
|
|
150
|
-
* @param { muteVideo: boolean; muteAudio: boolean } params 可选参数,是否开启麦克风或者摄像头设备,默认情况下可以通过createClient配置即可
|
|
151
|
-
* @returns { IResult } 返回结果
|
|
152
|
-
*/
|
|
153
|
-
init(config?: IStreamInitConfig, params?: IStreamInitParams): Promise<any>;
|
|
154
|
-
/**
|
|
155
|
-
* 创建视频流/处理自定义视频流
|
|
156
|
-
*
|
|
157
|
-
* 1、创建各种类型配置
|
|
158
|
-
* 2、采集视频流
|
|
159
|
-
* 3、处理自定义视频流
|
|
160
|
-
*/
|
|
161
|
-
private createStream;
|
|
162
|
-
/**
|
|
163
|
-
* 合并音视频开关配置,处理当前会议视频模式
|
|
164
|
-
*/
|
|
165
|
-
private mergeCaptureConfig;
|
|
166
|
-
/**
|
|
167
|
-
* 初始化三种流配置
|
|
168
|
-
*/
|
|
169
|
-
private initStreamsConfig;
|
|
170
|
-
/**
|
|
171
|
-
* 创建预览流配置
|
|
172
|
-
*/
|
|
173
|
-
private initPreviewStreamConfig;
|
|
174
|
-
/**
|
|
175
|
-
* 创建发送N路流配置
|
|
176
|
-
*/
|
|
177
|
-
private initRemoteStreamsConfig;
|
|
178
|
-
/**
|
|
179
|
-
* 创建接收通道流配置
|
|
180
|
-
*/
|
|
181
|
-
private initPipelineStreamsConfig;
|
|
182
|
-
/**
|
|
183
|
-
* 采集最大分辨率视频流或音频流
|
|
184
|
-
*
|
|
185
|
-
* @returns { Promise<MediaStream | null> }
|
|
186
|
-
*/
|
|
187
|
-
private createUserMediaStream;
|
|
188
|
-
/**
|
|
189
|
-
* 获取通用采集音视频流约束配置
|
|
190
|
-
*
|
|
191
|
-
* @param { CaptureStatus } enableVideo - 是否启用Video采集
|
|
192
|
-
* @param { CaptureStatus } enableAudio - 是否启用Audio采集
|
|
193
|
-
* @param { IStreamConfig } enableStreamConfig - 可用的流配置
|
|
194
|
-
* @returns
|
|
195
|
-
*/
|
|
196
|
-
private getUserMediaConstraints;
|
|
197
|
-
/**
|
|
198
|
-
* 更新设备授权状态
|
|
199
|
-
*/
|
|
200
|
-
private updateDevicePermission;
|
|
201
|
-
/**
|
|
202
|
-
* 更新Stream配置状态
|
|
203
|
-
*
|
|
204
|
-
* @param { IStreamConfig } maxStreamConfig - 流配置
|
|
205
|
-
*/
|
|
206
|
-
private updateCurrentMode;
|
|
207
|
-
/**
|
|
208
|
-
* 重新尝试采集基础音频流
|
|
209
|
-
* 采集音频,不需要接收之前的StreamConfig,重新生成即可
|
|
210
|
-
*
|
|
211
|
-
* @returns { Promise<MediaStream | null> }
|
|
212
|
-
*/
|
|
213
|
-
private recreateAudioStream;
|
|
214
|
-
/**
|
|
215
|
-
* 重新尝试采集基础视频流
|
|
216
|
-
*
|
|
217
|
-
* @param { IStreamConfig } enableStreamConfig - 可分配的流配置
|
|
218
|
-
* @returns { Promise<MediaStream | null> }
|
|
219
|
-
*/
|
|
220
|
-
private recreateVideoStream;
|
|
221
|
-
/**
|
|
222
|
-
* 采集基础视频流失败,返回错误码
|
|
223
|
-
*
|
|
224
|
-
* @param { IStreamConfig } enableStreamConfig - 最大分辨率流配置
|
|
225
|
-
* @param { IStatus } error - 错误码
|
|
226
|
-
* @param { BaseStreamErrorParams } params - 配置
|
|
227
|
-
* @returns { Promise<IStatus> } 返回新的错误码
|
|
228
|
-
*/
|
|
229
|
-
private handleCaptureStreamException;
|
|
230
|
-
/**
|
|
231
|
-
* 获取基础采集视频流配置
|
|
232
|
-
* 获取最大的分辨率流配置,按照从大往小的采集流程
|
|
233
|
-
*
|
|
234
|
-
* @param { CaptureStatus } enableVideo - 是否启用视频
|
|
235
|
-
* @param { CaptureStatus } enableAudio - 是否启用音频
|
|
236
|
-
*/
|
|
237
|
-
private getEnableStreamConfig;
|
|
238
|
-
/**
|
|
239
|
-
* 根据当前可用的视频流配置,查找最高分辨率的视频流配置
|
|
240
|
-
*
|
|
241
|
-
* @returns { IStreamConfig | undefined }
|
|
242
|
-
*/
|
|
243
|
-
private getEnableContentStreamConfig;
|
|
244
|
-
/**
|
|
245
|
-
* 获取约束设置
|
|
246
|
-
*
|
|
247
|
-
* @private
|
|
248
|
-
* @param { CaptureStatus } video 采集视频流状态
|
|
249
|
-
* @param { CaptureStatus } audio 采集音频流状态
|
|
250
|
-
* @param { string } videoDeviceId 摄像头设备ID
|
|
251
|
-
* @param { string } audioDeviceId 麦克风设备ID
|
|
252
|
-
* @returns
|
|
253
|
-
*/
|
|
254
|
-
private getInitConstraints;
|
|
255
|
-
/**
|
|
256
|
-
* 获取约束设置
|
|
257
|
-
*
|
|
258
|
-
* @param { IStreamConfig } enableStreamConfig - 流配置
|
|
259
|
-
* @returns
|
|
260
|
-
*/
|
|
261
|
-
private getInitContentConstraints;
|
|
262
|
-
/**
|
|
263
|
-
* 更新流的配置
|
|
264
|
-
*
|
|
265
|
-
* @param { MediaStream | null } stream - 基础流
|
|
266
|
-
*/
|
|
267
|
-
private setStreams;
|
|
268
|
-
/**
|
|
269
|
-
* 设置预览画面流
|
|
270
|
-
*
|
|
271
|
-
* @param { MediaStream | null } stream - 基础流
|
|
272
|
-
*/
|
|
273
|
-
private setPreviewStream;
|
|
274
|
-
/**
|
|
275
|
-
* 设置发送画面流
|
|
276
|
-
*
|
|
277
|
-
* @param { MediaStream | null } mediaStream - 基础流
|
|
278
|
-
*/
|
|
279
|
-
private setRemoteStreams;
|
|
280
|
-
/**
|
|
281
|
-
* 移除流上的Track数据
|
|
282
|
-
*
|
|
283
|
-
* @param { MediaStream[] } streamList - Stream列表
|
|
284
|
-
* @param { StreamKind } kind - 流的类型
|
|
285
|
-
*/
|
|
286
|
-
private removeTracks;
|
|
287
|
-
setClientObj(client: Client): void;
|
|
288
|
-
/**
|
|
289
|
-
* 获取对应类型的StreamConfig
|
|
290
|
-
*
|
|
291
|
-
* @param { StreamKind } streamKind - stream类型
|
|
292
|
-
* @returns { IStreamConfig }
|
|
293
|
-
*/
|
|
294
|
-
getNormalStream(streamKind: StreamKind): IStreamConfig | undefined;
|
|
295
|
-
/**
|
|
296
|
-
* 通过采集到的stream更新对应的设备信息
|
|
297
|
-
*/
|
|
298
|
-
updateDeviceByLocalStream(): void;
|
|
299
|
-
/**
|
|
300
|
-
* 获取当前时刻音量大小,范围:0-100
|
|
301
|
-
*/
|
|
302
|
-
getAudioLevel(stream?: MediaStream): Promise<number>;
|
|
303
|
-
/**
|
|
304
|
-
* clear audio object
|
|
305
|
-
*/
|
|
306
|
-
clearAudioLevel(): void;
|
|
307
|
-
/**
|
|
308
|
-
* 停止和释放Content共享流
|
|
309
|
-
*/
|
|
310
|
-
closeContentStream(): void;
|
|
311
|
-
/**
|
|
312
|
-
* 创建share content stream
|
|
313
|
-
*
|
|
314
|
-
* @public
|
|
315
|
-
* @param { { screenAudio : boolean } } screenAudio 是否开启共享屏幕声音
|
|
316
|
-
*/
|
|
317
|
-
createContentStream(config?: ICreateContentConfig): Promise<IStreamConfig[]>;
|
|
318
|
-
/**
|
|
319
|
-
* 根据可用的流配置,采集共享视频流
|
|
320
|
-
* 如果失败,则降级采集
|
|
321
|
-
*
|
|
322
|
-
* @returns { Promise<MediaStream | IStatus> }
|
|
323
|
-
*/
|
|
324
|
-
private createContentBaseStream;
|
|
325
|
-
/**
|
|
326
|
-
* 采集Electron桌面共享视频流
|
|
327
|
-
*
|
|
328
|
-
* @param { string } selectedSourceId - 资源ID
|
|
329
|
-
* @returns { MediaStream }
|
|
330
|
-
*/
|
|
331
|
-
createElectronBaseStream(selectedSourceId: string): Promise<MediaStream>;
|
|
332
|
-
/**
|
|
333
|
-
* 获取Electron采集资源信息
|
|
334
|
-
*
|
|
335
|
-
* @param { desktopCapturer } desktopCapturer - 采集器
|
|
336
|
-
* @param { string[] } types - 采集的类型:屏幕/应用等
|
|
337
|
-
* @returns { Promise<ISource[] | any> }
|
|
338
|
-
*/
|
|
339
|
-
getElectronContentSources(desktopCapturer: any, types?: any): Promise<ISource[] | any>;
|
|
340
|
-
/**`
|
|
341
|
-
* Create share electron content stream
|
|
342
|
-
*
|
|
343
|
-
* @param { string } selectedSourceId - content stream source id
|
|
344
|
-
* @returns { Promise<IStreamConfig[]> }
|
|
345
|
-
*/
|
|
346
|
-
createElectronContentStream(selectedSourceId: string): Promise<IStreamConfig[]>;
|
|
347
|
-
getPreviewStream(isVideo?: boolean, isAudio?: boolean, params?: {
|
|
348
|
-
video: any;
|
|
349
|
-
audio: any;
|
|
350
|
-
}): Promise<MediaStream>;
|
|
351
|
-
/**
|
|
352
|
-
* 采集设备流
|
|
353
|
-
*
|
|
354
|
-
* @param { MediaStreamConstraints } constraints - 流约束配置
|
|
355
|
-
* @returns { MediaStream }
|
|
356
|
-
*/
|
|
357
|
-
private getUserMedia;
|
|
358
|
-
/**
|
|
359
|
-
* 采集桌面/应用流
|
|
360
|
-
*
|
|
361
|
-
* @param { MediaStreamConstraints } constraints - 流约束配置
|
|
362
|
-
* @returns { MediaStream }
|
|
363
|
-
*/
|
|
364
|
-
private getDisplayMedia;
|
|
365
|
-
/**
|
|
366
|
-
* 增加延迟,解决Chrome浏览器获取实时Track分辨率不正确问题
|
|
367
|
-
*/
|
|
368
|
-
private nextProcessor;
|
|
369
|
-
/**
|
|
370
|
-
* 监听ContentStream终止事件
|
|
371
|
-
*/
|
|
372
|
-
private handleCloseContentEvent;
|
|
373
|
-
/**
|
|
374
|
-
* 加工处理ContentStream
|
|
375
|
-
*
|
|
376
|
-
* @param { MediaStream } stream - Screen stream
|
|
377
|
-
*/
|
|
378
|
-
private setContentStreams;
|
|
379
|
-
private contentStreamProcessor;
|
|
380
|
-
/**
|
|
381
|
-
* 创建
|
|
382
|
-
*/
|
|
383
|
-
private initContentStreamsConfig;
|
|
384
|
-
/**
|
|
385
|
-
* handle create stream error case
|
|
386
|
-
*
|
|
387
|
-
* @param { any } err - create content stream error params
|
|
388
|
-
*/
|
|
389
|
-
private handleCreateContentStreamError;
|
|
390
|
-
/**
|
|
391
|
-
* Handle create people stream error case
|
|
392
|
-
*
|
|
393
|
-
* @param { any } err - create people stream error params
|
|
394
|
-
*/
|
|
395
|
-
private handleCreateStreamError;
|
|
396
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XYLink WebRTC Video Manager Lib
|
|
3
|
-
*
|
|
4
|
-
* @summary render video stream
|
|
5
|
-
* @author jinghui-Luo
|
|
6
|
-
*
|
|
7
|
-
* Created at : 2020-12-18 16:54:15
|
|
8
|
-
* Last modified : 2024-04-18 16:43:44
|
|
9
|
-
*/
|
|
10
|
-
import Logger from '../tools/logger';
|
|
11
|
-
declare class VideoManager {
|
|
12
|
-
videoEle: HTMLVideoElement | null;
|
|
13
|
-
state: '' | 'CANPLAY' | 'ENDED' | 'REQUEST';
|
|
14
|
-
private key;
|
|
15
|
-
private wrapEleId;
|
|
16
|
-
private cb;
|
|
17
|
-
private stream;
|
|
18
|
-
private streamId;
|
|
19
|
-
private loadStatus;
|
|
20
|
-
private streamStatus;
|
|
21
|
-
private streamStatusTimmer;
|
|
22
|
-
private streamTimmerCountDown;
|
|
23
|
-
private logger;
|
|
24
|
-
private isContent;
|
|
25
|
-
constructor(logger?: Logger, isContent?: boolean);
|
|
26
|
-
/**
|
|
27
|
-
* client set video stream data
|
|
28
|
-
*
|
|
29
|
-
* @param key endpointId + mediagroupId => pid
|
|
30
|
-
* @param stream MediaStream or null
|
|
31
|
-
*/
|
|
32
|
-
initVideoStreamById(key: string, stream: MediaStream | null): void;
|
|
33
|
-
getVideoTracks(): MediaStreamTrack[];
|
|
34
|
-
updateLocalTrack(): void;
|
|
35
|
-
private initVideoSource;
|
|
36
|
-
private setSrcObject;
|
|
37
|
-
private initEventListener;
|
|
38
|
-
private removeEventListener;
|
|
39
|
-
private initStreamTrackEventListener;
|
|
40
|
-
private removeStreamTrackEventListener;
|
|
41
|
-
isHaveSrcObject(): MediaProvider | null;
|
|
42
|
-
setSource(id: string, wrapEleId: string): void;
|
|
43
|
-
destroy(): void;
|
|
44
|
-
setVideoStatusChange(cb: any): void;
|
|
45
|
-
private onEnded;
|
|
46
|
-
/**
|
|
47
|
-
* mute到unmute的变换可能会很迅速,所以1s以内的变换可以使用freeze替代
|
|
48
|
-
*/
|
|
49
|
-
private onMute;
|
|
50
|
-
private onUnmute;
|
|
51
|
-
private onWaiting;
|
|
52
|
-
private onCanPlay;
|
|
53
|
-
private clearTrackStatusTimmer;
|
|
54
|
-
private sendVideoStatus;
|
|
55
|
-
private emmit;
|
|
56
|
-
}
|
|
57
|
-
export default VideoManager;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Audio Level class
|
|
3
|
-
*
|
|
4
|
-
* get audio level
|
|
5
|
-
*
|
|
6
|
-
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
7
|
-
* @date 2019-11-08 16:03:15
|
|
8
|
-
*/
|
|
9
|
-
export declare class AudioLevel {
|
|
10
|
-
level: number;
|
|
11
|
-
private stream;
|
|
12
|
-
private audioContext;
|
|
13
|
-
private analyser;
|
|
14
|
-
private sourceNode;
|
|
15
|
-
private timeDomainData;
|
|
16
|
-
constructor(stream: MediaStream);
|
|
17
|
-
/**
|
|
18
|
-
* 获取声音level数据。
|
|
19
|
-
* rang: 0-100
|
|
20
|
-
*/
|
|
21
|
-
getAudioLevel(): number;
|
|
22
|
-
init(): void;
|
|
23
|
-
}
|
package/lib/tools/detect.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detect 检测浏览器支持情况
|
|
3
|
-
* @authors Luo-jinghui (luojinghui424@gmail.com)
|
|
4
|
-
* @date 2019-10-22 11:11:55
|
|
5
|
-
*/
|
|
6
|
-
interface ISupportFeature {
|
|
7
|
-
isSupportRTC: boolean;
|
|
8
|
-
isSupportAddtrack: boolean;
|
|
9
|
-
isSupportAddTransceiver: boolean;
|
|
10
|
-
isSupportReplaceTrack: boolean;
|
|
11
|
-
isApplyConstraints: boolean;
|
|
12
|
-
isSupportSetStreams: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface ISupportTest {
|
|
15
|
-
isSupportPeer: boolean;
|
|
16
|
-
isSupportAddtrack: boolean;
|
|
17
|
-
isSupportAddTransceiver: boolean;
|
|
18
|
-
isSupportReplaceTrack: boolean;
|
|
19
|
-
isApplyConstraints: boolean;
|
|
20
|
-
isSupportSetStreams: boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare const detect: {
|
|
23
|
-
isMinBrowser: () => boolean;
|
|
24
|
-
isFirefox: () => boolean;
|
|
25
|
-
isSupportAspectRatio: () => boolean;
|
|
26
|
-
isSupportReauthorize: () => boolean;
|
|
27
|
-
isSupportUserMedia: () => boolean;
|
|
28
|
-
isSupportRTC: (videoCapture?: MediaStream) => Promise<ISupportFeature>;
|
|
29
|
-
isSupportPeerCB: (videoCapture?: MediaStream) => Promise<ISupportTest>;
|
|
30
|
-
isSupportWebsocket: () => boolean;
|
|
31
|
-
isSupportMedia: () => boolean;
|
|
32
|
-
isSupportH264: () => Promise<boolean>;
|
|
33
|
-
osVersion: () => string;
|
|
34
|
-
/**
|
|
35
|
-
* 获取浏览器当前网络信息
|
|
36
|
-
* 兼容:Chrome、Edge,不兼容:Safari、Firefox
|
|
37
|
-
*
|
|
38
|
-
* @returns { undefined | NetworkInformation } 网络信息
|
|
39
|
-
*/
|
|
40
|
-
getNetWork: () => string;
|
|
41
|
-
};
|
|
42
|
-
export declare const isFirefox: boolean;
|
|
43
|
-
export {};
|
package/lib/type/device.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 采集权限状态
|
|
3
|
-
*
|
|
4
|
-
* @param GRANTED granted - 已授权
|
|
5
|
-
* @param DENIED denied - 已拒绝
|
|
6
|
-
* @param PROMPT prompt - 询问中
|
|
7
|
-
* @param UNKNOWN unknown - 未知
|
|
8
|
-
* @param FAILED failed - 失败
|
|
9
|
-
*/
|
|
10
|
-
export declare enum PermissionType {
|
|
11
|
-
'GRANTED' = "granted",
|
|
12
|
-
'DENIED' = "denied",
|
|
13
|
-
'PROMPT' = "prompt",
|
|
14
|
-
'UNKNOWN' = "unknown",
|
|
15
|
-
'FAILED' = "failed"
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 获取设备信息
|
|
19
|
-
*
|
|
20
|
-
* @property { string } deviceId 设备id
|
|
21
|
-
* @property { string } label 设备名称
|
|
22
|
-
* @property { string } groupId 设备分组
|
|
23
|
-
* @property { 'output' | 'input' } direction 设备方向
|
|
24
|
-
* @value output 输出设备
|
|
25
|
-
* @value input 输入设备
|
|
26
|
-
* @property { 'audioinput' | 'audiooutput' | 'videoinput' } kind 设备种类
|
|
27
|
-
* @value audioinput 音频输入
|
|
28
|
-
* @value audiooutput 音频输出
|
|
29
|
-
* @value videoinput 摄像头输入
|
|
30
|
-
* @property { string } type 设备采集流类型:video/audio
|
|
31
|
-
*/
|
|
32
|
-
export type IDeviceInfo = {
|
|
33
|
-
deviceId: string;
|
|
34
|
-
label: string;
|
|
35
|
-
groupId?: string;
|
|
36
|
-
direction?: 'output' | 'input';
|
|
37
|
-
kind?: 'audioinput' | 'audiooutput' | 'videoinput';
|
|
38
|
-
type?: 'video' | 'audio';
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* 设备列表:麦克风、扬声器、摄像头
|
|
42
|
-
*
|
|
43
|
-
* @property { IDeviceInfo[] } audioInputList 麦克风列表
|
|
44
|
-
* @property { IDeviceInfo[] } audioOutputList 扬声器列表
|
|
45
|
-
* @property { IDeviceInfo[] } videoInList 摄像头列表
|
|
46
|
-
*/
|
|
47
|
-
export type IDeviceList = {
|
|
48
|
-
audioInputList: IDeviceInfo[];
|
|
49
|
-
audioOutputList: IDeviceInfo[];
|
|
50
|
-
videoInList: IDeviceInfo[];
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* 当前已选择设备信息
|
|
54
|
-
*
|
|
55
|
-
* @property { IDeviceInfo | undefined } audioInput 麦克风设备
|
|
56
|
-
* @property { IDeviceInfo | undefined } audioOutput 扬声器设备
|
|
57
|
-
* @property { IDeviceInfo | undefined } videoInput 摄像头设备
|
|
58
|
-
*/
|
|
59
|
-
export type ISelectedDevice = {
|
|
60
|
-
audioInput: IDeviceInfo | undefined;
|
|
61
|
-
videoInput: IDeviceInfo | undefined;
|
|
62
|
-
audioOutput: IDeviceInfo | undefined;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* 设备变化事件
|
|
66
|
-
*
|
|
67
|
-
* @property { ISelectedDevice } nextDevice 最新的设备
|
|
68
|
-
* @property { IDeviceList } detail 最新设备详细信息
|
|
69
|
-
*/
|
|
70
|
-
export type IDeviceManagerChangeValue = {
|
|
71
|
-
nextDevice: ISelectedDevice;
|
|
72
|
-
detail: IDeviceList;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* 当前麦克风/摄像头权限
|
|
76
|
-
*
|
|
77
|
-
* @property { PermissionType } microphone 麦克风权限
|
|
78
|
-
* @property { PermissionType } camera 摄像头权限
|
|
79
|
-
*/
|
|
80
|
-
export interface ICurrentPermission {
|
|
81
|
-
microphone: PermissionType;
|
|
82
|
-
camera: PermissionType;
|
|
83
|
-
}
|