@xylink/xy-rtc-sdk 2.0.1-beta.9 → 2.0.3-beta.12

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.
@@ -0,0 +1,350 @@
1
+ import { IStatus } from './base';
2
+ /**
3
+ * MediaTrack状态
4
+ *
5
+ * @value ENABLED 默认状态,无异常
6
+ * @value MUTE 流正在请求中
7
+ * @value ENDED 流已关闭
8
+ */
9
+ export declare type IStreamTrackStatus = 'ENABLED' | 'MUTE' | 'ENDED';
10
+ /**
11
+ * 自定义流类型
12
+ *
13
+ * @property { 'video' | 'audio' } kind 流类型,分video和audio
14
+ */
15
+ export declare type TCustomStream = {
16
+ kind: 'video' | 'audio';
17
+ };
18
+ /**
19
+ * 采集Media流的状态
20
+ *
21
+ * @value NORMAL 正常
22
+ * @value DOMSTRING 创建协商通道流
23
+ * @value INVALID 失效
24
+ */
25
+ export declare type IStreamStatus = 'NORMAL' | 'DOMSTRING' | 'INVALID';
26
+ /**
27
+ * 自定义采集流时产生的状态
28
+ *
29
+ * @value NORMAL 采集正常
30
+ * @value SEND_ONLY 仅发送(无权限、无设备等无流入会情况)
31
+ * @value AUDIO_ONLY 仅采集麦克风流,视频流转仅接收模式
32
+ * @value VIDEO_ONLY 仅采集摄像头流,麦克风转仅接收模式
33
+ * @value FAILED 其他异常,无法入会
34
+ */
35
+ export declare type IStreamCurrentType = 'NORMAL' | 'SEND_ONLY' | 'AUDIO_ONLY' | 'VIDEO_ONLY' | 'FAILED';
36
+ /**
37
+ * 自定义流类型
38
+ *
39
+ * @value contentStream 共享内容流
40
+ * @value previewStream 本地预览流
41
+ * @value pipelineStream 建立通道流
42
+ * @value remoteStream 仅接收远端画面流
43
+ */
44
+ export declare type IStreamObjType = 'contentStream' | 'previewStream' | 'pipelineStream' | 'remoteStream';
45
+ /**
46
+ * 请流时,控制流的帧率
47
+ *
48
+ * @value 100 低帧率
49
+ * @value 200 高帧率
50
+ */
51
+ export declare type IMediaQualityType = 0 | 100 | 200;
52
+ /**
53
+ * 自定义流数据
54
+ *
55
+ * @property { MediaStream | null } stream 采集设备流
56
+ * @property { TCustomStream[] } domStream 协商通道流
57
+ * @property { IStreamStatus } status 状态
58
+ * @property { IStreamObjType } type 自定义流类型
59
+ * @property { string } resolution 分辨率
60
+ */
61
+ export interface IStreamObj {
62
+ stream: MediaStream | null;
63
+ domStream: TCustomStream[];
64
+ status: IStreamStatus;
65
+ type: IStreamObjType;
66
+ resolution: string;
67
+ }
68
+ /**
69
+ * 流集合
70
+ *
71
+ * @property { IStreamObj[] } previewStreams 本地预览流
72
+ * @property { IStreamObj[] } streams 发送远端流
73
+ * @property { IStreamObj[] } pipelineStreams 协商通道流
74
+ * @property { IStreamObj[] } contentStreams 共享内容流
75
+ */
76
+ export interface IGetMediaStreams {
77
+ previewStreams: IStreamObj[];
78
+ streams: IStreamObj[];
79
+ pipelineStreams: IStreamObj[];
80
+ contentStreams: IStreamObj[];
81
+ }
82
+ /**
83
+ * Stream类采集流的状态和信息
84
+ *
85
+ * @property { IStreamCurrentType } type 流的采集状态:采集正常、仅发送、其他异常
86
+ * @property { string } detail 错误消息
87
+ */
88
+ export interface IStreamCurrent {
89
+ type: IStreamCurrentType;
90
+ detail: string | IStatus;
91
+ }
92
+ /**
93
+ * publish推送流数据到Peer链接
94
+ *
95
+ * @property { boolean } isShareContent 是否是共享内容流
96
+ * @property { boolean } isShareFile 是否是分享文件
97
+ * @property { boolean } isShareWhiteBoard 是否是白板
98
+ * @property { boolean } isSharePeople 是否是people流
99
+ */
100
+ export interface IPublishParams {
101
+ isShareContent?: boolean;
102
+ isShareFile?: boolean;
103
+ isShareWhiteBoard?: boolean;
104
+ isSharePeople?: boolean;
105
+ }
106
+ /**
107
+ * 封装Stream Sender
108
+ *
109
+ * @property { string } resolution 当前通道发送的流的分辨率
110
+ * @property { MediaStreamTrack | null } track 当前通道发送的Track流
111
+ * @property { RTCRtpSender | null } RTCSender
112
+ * @property { string } status 状态
113
+ * @property { string } type 类型
114
+ */
115
+ export interface IStreamSender {
116
+ resolution: string;
117
+ track: MediaStreamTrack | null;
118
+ sender: RTCRtpSender;
119
+ status: string;
120
+ type: string;
121
+ }
122
+ /**
123
+ * Electron选择分享应用/屏幕资源
124
+ *
125
+ * @property { unknown } appIcon 资源icon
126
+ * @property { string } display_id 显示id
127
+ * @property { string } id 资源id
128
+ * @property { string } name 应用名称/屏幕名称
129
+ * @property { unknown } thumbnail thumbnail type is NativeImage
130
+ */
131
+ export interface ISource {
132
+ appIcon: any;
133
+ display_id: string;
134
+ id: string;
135
+ name: string;
136
+ thumbnail: any;
137
+ }
138
+ /**
139
+ * stream init配置参数,用于在初始采集视频/音频流时指定设备信息
140
+ *
141
+ * @property { Object } devices 麦克风/摄像头/扬声器 设备id
142
+ * @value { string } devices.audioInputValue 音频输入
143
+ * @value { string } devices.videoInValue 视频输入
144
+ * @value { string } devices.audioOutputValue 音频输出
145
+ */
146
+ export declare type IStreamInitConfog = {
147
+ devices: {
148
+ audioInputValue?: string;
149
+ videoInValue?: string;
150
+ audioOutputValue?: string;
151
+ };
152
+ };
153
+ /**
154
+ * Internels 统计数据
155
+ *
156
+ * @property { number } bytesReceived 接收的字节总数
157
+ * @property { number } bytesReceivedSecond 每秒接收字节数
158
+ * @property { number } bytesSent 发送的字节总数
159
+ * @property { number } bytesSentSecond 每秒发送字节数
160
+ * @property { string } mimeType 视频类型
161
+ * @property { number } timestamp 时间戳
162
+ * @property { [prop: string]: IReceiver } receiver 所有接收视频的列表数据
163
+ * @property { [prop: string]: ISender } sender 所有发送视频的列表数据
164
+ */
165
+ export interface IInternels {
166
+ bytesReceived: number;
167
+ bytesReceivedSecond: number;
168
+ bytesSent: number;
169
+ bytesSentSecond: number;
170
+ mimeType: string;
171
+ timestamp: number;
172
+ receiver: {
173
+ [prop: string]: IReceiver;
174
+ };
175
+ sender: {
176
+ [prop: string]: ISender;
177
+ };
178
+ }
179
+ /**
180
+ * 接收器 Receiver 统计数据
181
+ * 详情可参考:https://w3c.github.io/webrtc-stats/#dictionary-rtcreceivedrtpstreamstats-members
182
+ *
183
+ * @property { number } bytesReceived 接收总量
184
+ * @property { number } bytesReceivedSecond 每秒接收数据
185
+ * @property { number } frameHeight 解码帧的height
186
+ * @property { number } frameWidth 解码帧的width
187
+ * @property { number } framesDecoded frame编码量
188
+ * @property { number } framesDecodedSecond 每秒frame编码量
189
+ * @property { number } framesReceived frame接收量
190
+ * @property { number } framesReceivedSecond 每秒frame接收量
191
+ * @property { boolean } isContent 是否是分享content
192
+ * @property { boolean } isSupport 忽略
193
+ * @property { number } jitterBufferDelay 音频样本或视频帧从接收到退出抖动缓冲区所花费的时间总和,以秒为单位
194
+ * @property { number } keyFramesDecoded 代表关键帧的总数
195
+ * @property { number } nackCount 计算此接收器发送的否定确认(NACK)数据包的总数
196
+ * @property { string } name 与会者昵称
197
+ * @property { number } packetsReceived 此传输上收到的数据包总数
198
+ * @property { number } pliCount 接收器发送的图片丢失指示(PLI)数据包的总数
199
+ * @property { number } timestamp 时间戳
200
+ * @property { string } type 与会者type
201
+ * @property { number } expResolution 当前通道期望流分辨率
202
+ * @property { string } status 状态
203
+ * @property { number } framesPerSecond 此接收器解码的帧的 QP 值的总和
204
+ * @property { string } ssrc 同步源 (ssrc) 标识符是每个 [RFC3550] 的无符号整数值,用于标识此 stats 对象正在描述的 RTP 数据包流;
205
+ * 对于出站和入站本地,ssrc 描述了分别由这些端点发送和接收的轨道的统计信息;
206
+ * 对于远程入站和远程出站,ssrc 描述了由远程端点接收和发送到远程端点的轨道的统计信息;
207
+ * @property { number } jitter 视频接收抖动
208
+ * @property { string } endpointId 参会者的callUri
209
+ * @property { string } participantId participantId
210
+ */
211
+ export interface IReceiver {
212
+ bytesReceived: number;
213
+ bytesReceivedSecond: number;
214
+ frameHeight: number;
215
+ frameWidth: number;
216
+ framesDecoded: number;
217
+ framesDecodedSecond: number;
218
+ framesReceived: number;
219
+ framesReceivedSecond: number;
220
+ isContent: boolean;
221
+ isSupport: boolean;
222
+ jitterBufferDelay: number;
223
+ keyFramesDecoded: number;
224
+ nackCount: number;
225
+ name: string;
226
+ packetsReceived: number;
227
+ pliCount: number;
228
+ timestamp: number;
229
+ type: string;
230
+ expResolution: number;
231
+ status: string;
232
+ framesPerSecond: number;
233
+ framesDropped: number;
234
+ ssrc: string;
235
+ jitter: number;
236
+ endpointId?: string;
237
+ participantId?: number;
238
+ }
239
+ /**
240
+ * 发送器 Sender 统计数据
241
+ * 详情可以参考:https://w3c.github.io/webrtc-stats/#dictionary-rtcoutboundrtpstreamstats-members
242
+ *
243
+ * @property { number } bytesSent 此RTCIceTransport上发送的有效负载字节总数
244
+ * @property { number } bytesSentSecond 每秒发送有效负载字节数
245
+ * @property { number } frameHeight 编码帧的高度
246
+ * @property { number } frameWidth 编码帧的宽度
247
+ * @property { number } framesEncoded 此RTP媒体流成功编码的帧总数
248
+ * @property { number } framesEncodedSecond 每秒成功编码的帧数
249
+ * @property { number } framesSent 此RTP流上发送的帧总数
250
+ * @property { number } framesSentSecond 每秒发送的帧数
251
+ * @property { number } hugeFramesSent 此RTP流发送的huge帧的总数
252
+ * @property { string } status 忽略
253
+ * @property { number } keyFramesEncoded 此RTP媒体流编码的关键帧总数
254
+ * @property { number } packetsSent 此传输发送的数据包总数
255
+ * @property { number } timestamp 时间戳
256
+ * @property { string } type 发送器类型
257
+ * @property { number } expBandwidth 期望带宽
258
+ * @property { string } string 分辨率
259
+ * @property { number } pliCount 计算此发送方收到的图片丢失指示 (PLI) 数据包的总数
260
+ * @property { number } nackCount 计算此发送方收到的否定确认 (NACK) 数据包的总数
261
+ * @property { string } ssrc 标识此 stats 对象正在描述的 RTP 数据包流;
262
+ * 对于出站和入站本地,ssrc 描述了分别由这些端点发送和接收的轨道的统计信息;
263
+ * 对于远程入站和远程出站,ssrc 描述了由远程端点接收和发送到远程端点的轨道的统计信息;
264
+ */
265
+ export interface ISender {
266
+ bytesSent: number;
267
+ bytesSentSecond: number;
268
+ frameHeight: number;
269
+ frameWidth: number;
270
+ framesEncoded: number;
271
+ framesEncodedSecond: number;
272
+ framesSent: number;
273
+ framesSentSecond: number;
274
+ hugeFramesSent: number;
275
+ status: string;
276
+ keyFramesEncoded: number;
277
+ packetsSent: number;
278
+ timestamp: number;
279
+ type: string;
280
+ expBandwidth: number;
281
+ resolution: string;
282
+ pliCount: number;
283
+ nackCount: number;
284
+ ssrc: string;
285
+ }
286
+ /**
287
+ * 基础视频约束配置
288
+ *
289
+ * @property { ConstrainDouble } frameRate 帧率配置
290
+ * @property { number } aspectRatio 视频比例
291
+ * @property { 'crop-and-scale' } resizeMode 裁剪模式,此处使用裁剪比例模式,以满足分辨率要求;
292
+ */
293
+ export interface IBASE_CONTRAINTS {
294
+ frameRate: ConstrainDouble;
295
+ aspectRatio: number;
296
+ resizeMode: 'crop-and-scale';
297
+ }
298
+ /**
299
+ * 初始化视频约束设置
300
+ *
301
+ * @property { string } cursor 用于指定content分享时,是否指定显示鼠标指针的显示/隐藏或者是否需要录制鼠标
302
+ * @property { number } aspectRatio 期待采集视频比例
303
+ * @property { 'crop-and-scale' } resizeMode 裁剪模式,此处使用裁剪比例模式,以满足分辨率要求;
304
+ * @property { ConstrainDouble } frameRate 裁剪模式,此处使用裁剪比例模式,以满足分辨率要求;
305
+ * @property { boolean } logicalSurface 指示是否允许用户选择不直接对应于显示区域的源表面;
306
+ * 详见:https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/logicalSurface
307
+ */
308
+ export interface ICONTENT_CONTRAINTS {
309
+ cursor: string;
310
+ aspectRatio: number;
311
+ resizeMode: 'crop-and-scale';
312
+ frameRate: ConstrainDouble;
313
+ logicalSurface: true;
314
+ }
315
+ /**
316
+ * 媒体通知Web对视频流的分辨率、带宽信息、帧率进行限制
317
+ *
318
+ * @property { string } streamId 指定streamId进行限制
319
+ * @property { number } resolution 暂时未使用
320
+ * @property { number } bandwidth 限制streamId最大发送带宽
321
+ * @property { number } frameRate 限制streamId最大发送帧率(暂时未启用,存在帧率动态设置后,帧率起不来问题)
322
+ */
323
+ export interface IStreamChange {
324
+ streamId: string;
325
+ resolution: number;
326
+ bandwidth: number;
327
+ frameRate: number;
328
+ }
329
+ /**
330
+ * StreamChange消息内容
331
+ *
332
+ * @property { string } type 消息类型
333
+ * @property { IStreamChange[] } streamChangeInfo 流限制配置信息
334
+ * @property { number } mediagroupid 是否是content或者people画面
335
+ */
336
+ export interface IStreamChangeType {
337
+ type: string;
338
+ streamChangeInfo: IStreamChange[];
339
+ mediagroupid: number;
340
+ }
341
+ /**
342
+ * 缓存content和people的StreamChange配置数据
343
+ *
344
+ * @property { IStreamChange[] } content content的streamchange数据
345
+ * @property { IStreamChange[] } people content的streamchange数据
346
+ */
347
+ export interface IStreamChangeListType {
348
+ content: IStreamChange[];
349
+ people: IStreamChange[];
350
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylink/xy-rtc-sdk",
3
- "version": "2.0.1-beta.9",
3
+ "version": "2.0.3-beta.12",
4
4
  "description": "XYRTC SDK(小鱼易连web音视频 sdk)",
5
5
  "keywords": [
6
6
  "webrtc",
@@ -8,16 +8,19 @@
8
8
  "xyrtc",
9
9
  "xyrtc sdk"
10
10
  ],
11
- "main": "./lib/index.js",
12
- "types": "./lib/index.d.ts",
11
+ "main": "lib/index.js",
12
+ "types": "lib/src/index.d.ts",
13
13
  "scripts": {
14
- "start": "NODE_ENV=development webpack-dev-server --mode development",
14
+ "start": "vite",
15
+ "dev": "vite",
16
+ "build:demo": "tsc && vite build",
17
+ "preview": "vite preview",
15
18
  "build-watch": "rollup -c -w",
16
19
  "build": "NODE_ENV=production rollup -c",
17
- "build:demo": "NODE_ENV=production webpack --mode production",
18
20
  "test": "jest",
19
21
  "version:beta": "npm version prerelease --preid=beta",
20
- "publish:beta": "npm publish --tag beta --access public"
22
+ "publish:beta": "npm publish --tag beta --access public",
23
+ "xytools": "xytools"
21
24
  },
22
25
  "author": "jinghui-Luo",
23
26
  "email": "luojinghui424@gmail.com",
@@ -35,10 +38,16 @@
35
38
  "@babel/preset-typescript": "^7.7.4",
36
39
  "@rollup/plugin-node-resolve": "^7.0.0",
37
40
  "@rollup/plugin-replace": "^2.3.0",
41
+ "@types/clone-deep": "^4.0.1",
42
+ "@types/crypto-js": "^4.0.1",
43
+ "@types/downloadjs": "^1.4.2",
44
+ "@types/react": "^17.0.3",
45
+ "@types/react-dom": "^17.0.6",
46
+ "@types/uuid": "^8.3.0",
38
47
  "@typescript-eslint/eslint-plugin": "^2.9.0",
39
48
  "@typescript-eslint/parser": "^2.9.0",
40
- "ali-oss-folder": "^1.0.5",
41
- "antd": "^4.6.2",
49
+ "@vitejs/plugin-react-refresh": "^1.3.2",
50
+ "antd": "4.6.2",
42
51
  "axios": "^0.19.1",
43
52
  "babel-loader": "^8.0.6",
44
53
  "babel-plugin-import": "^1.12.2",
@@ -47,27 +56,20 @@
47
56
  "babel-preset-es2015": "^6.24.1",
48
57
  "babel-preset-react": "^6.24.1",
49
58
  "babel-preset-react-app": "^9.0.2",
50
- "clean-webpack-plugin": "^3.0.0",
51
59
  "clone-deep": "^4.0.1",
52
60
  "core-js": "^3.6.5",
53
- "css-loader": "^3.2.0",
54
- "css-modules-typescript-loader": "^3.0.1",
55
61
  "downloadjs": "^1.4.7",
56
62
  "eslint": "^6.7.1",
57
63
  "eslint-config-alloy": "^3.4.0",
58
- "file-loader": "4.3.0",
59
- "html-loader": "^0.5.5",
60
- "html-webpack-plugin": "^3.2.0",
64
+ "husky": "^4.3.8",
61
65
  "jest": "^25.1.0",
62
66
  "jszip": "^3.5.0",
63
67
  "less": "^3.10.3",
64
- "less-loader": "^5.0.0",
65
- "mini-css-extract-plugin": "^0.8.0",
66
- "node-sass": "npm:sass",
68
+ "lint-staged": "^10.5.4",
67
69
  "prettier": "^1.19.1",
68
70
  "react": "^16.10.2",
69
71
  "react-dom": "^16.10.2",
70
- "rollup": "^1.27.5",
72
+ "rollup": "^2.44.0",
71
73
  "rollup-plugin-babel": "^4.3.3",
72
74
  "rollup-plugin-cleanup": "^3.2.1",
73
75
  "rollup-plugin-clear": "^2.0.7",
@@ -75,30 +77,51 @@
75
77
  "rollup-plugin-json": "^4.0.0",
76
78
  "rollup-plugin-sourcemaps": "^0.4.2",
77
79
  "rollup-plugin-terser": "^5.1.2",
78
- "rollup-plugin-typescript": "^1.0.1",
79
80
  "rollup-plugin-typescript2": "^0.25.2",
80
- "sass-loader": "^8.0.0",
81
- "string-replace-loader": "^2.2.0",
82
- "style-loader": "^1.0.0",
83
- "terser-webpack-plugin": "^2.1.3",
84
- "ts-loader": "^6.2.0",
85
- "tslib": "^1.10.0",
86
- "typescript": "^3.7.2",
87
- "typings-for-css-modules-loader": "^1.7.0",
88
- "url-loader": "^2.2.0",
81
+ "sass": "^1.32.10",
82
+ "typescript": "^4.3.2",
83
+ "validate-commit-msg": "^2.14.0",
89
84
  "vconsole": "^3.3.4",
90
- "webpack": "^4.41.1",
91
- "webpack-cli": "^3.3.9",
92
- "webpack-dev-server": "^3.8.2"
85
+ "vite": "^2.1.5",
86
+ "vite-plugin-imp": "^2.0.7",
87
+ "vite-plugin-importer": "^0.2.1",
88
+ "xytools": "1.5.2-beta.4"
93
89
  },
94
90
  "dependencies": {
95
91
  "crypto-js": "^4.0.0",
96
92
  "dexie": "^2.0.4",
97
93
  "dexie-export-import": "^1.0.0-rc.1",
94
+ "js-base64": "^3.6.1",
98
95
  "qs": "^6.9.4",
99
96
  "uuid": "^7.0.2"
100
97
  },
101
- "resolution": {
102
- "node-sass": "npm:sass"
98
+ "husky": {
99
+ "hooks": {
100
+ "pre-commit": "lint-staged",
101
+ "commit-msg": "validate-commit-msg"
102
+ }
103
+ },
104
+ "config": {
105
+ "validate-commit-msg": {
106
+ "types": [
107
+ "feat",
108
+ "fix",
109
+ "docs",
110
+ "style",
111
+ "refactor",
112
+ "perf",
113
+ "test",
114
+ "build",
115
+ "ci",
116
+ "chore",
117
+ "revert",
118
+ "merge"
119
+ ]
120
+ }
121
+ },
122
+ "lint-staged": {
123
+ "{src,demo}/**/*.{js,jsx,json,ts,tsx,scss,sass,css,md}": [
124
+ "prettier --write"
125
+ ]
103
126
  }
104
127
  }
@@ -1,2 +0,0 @@
1
- declare const setStream: (layout: any) => any;
2
- declare const getVideoStreamByTrackId: (videoTrackId: string) => any;