trtc-electron-sdk 9.3.201 → 9.4.105-beta.1
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/liteav/Render/SoftwareRenderer/index.js +38 -1
- package/liteav/trtc.d.ts +86 -105
- package/liteav/trtc.js +468 -560
- package/liteav/trtc_define.d.ts +10 -79
- package/liteav/trtc_define.js +11 -117
- package/package.json +8 -8
|
@@ -74,7 +74,6 @@ class Renderer {
|
|
|
74
74
|
this.yuv = null;
|
|
75
75
|
this.element = null;
|
|
76
76
|
this.canvas = null;
|
|
77
|
-
this.view = null;
|
|
78
77
|
}
|
|
79
78
|
refreshCanvas() {
|
|
80
79
|
}
|
|
@@ -109,11 +108,49 @@ class Renderer {
|
|
|
109
108
|
this.canvas.style.transform = 'rotateY(180deg)';
|
|
110
109
|
}
|
|
111
110
|
}
|
|
111
|
+
_adjustImageData(imageData) {
|
|
112
|
+
const { width, height, yUint8Array, uUint8Array, vUint8Array } = imageData;
|
|
113
|
+
const widthBase = 8;
|
|
114
|
+
const w8Modulo = width % widthBase;
|
|
115
|
+
if (w8Modulo !== 0) {
|
|
116
|
+
const newWidth = width - w8Modulo;
|
|
117
|
+
const newYSize = newWidth * height;
|
|
118
|
+
const newYArrayBuffer = new ArrayBuffer(newYSize);
|
|
119
|
+
const newYUint8Array = new Uint8Array(newYArrayBuffer);
|
|
120
|
+
let oldIndex = -1, newIndex = -1;
|
|
121
|
+
for (let h = 0; h < height; h += 1) {
|
|
122
|
+
for (let w = 0; w < newWidth; w += 1) {
|
|
123
|
+
oldIndex = width * h + w;
|
|
124
|
+
newIndex = newWidth * h + w;
|
|
125
|
+
newYUint8Array[newIndex] = yUint8Array[oldIndex];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const oldChromaWidth = width / 2;
|
|
129
|
+
const newChromaWidth = newWidth / 2;
|
|
130
|
+
const chromaHeight = height / 2;
|
|
131
|
+
const newChromaSize = newChromaWidth * chromaHeight;
|
|
132
|
+
const newUArrayBuffer = new ArrayBuffer(newChromaSize);
|
|
133
|
+
const newUInt8Array = new Uint8Array(newUArrayBuffer);
|
|
134
|
+
const newVArrayBuffer = new ArrayBuffer(newChromaSize);
|
|
135
|
+
const newVInt8Array = new Uint8Array(newVArrayBuffer);
|
|
136
|
+
for (let h = 0; h < chromaHeight; h += 1) {
|
|
137
|
+
for (let w = 0; w < newChromaWidth; w += 1) {
|
|
138
|
+
oldIndex = oldChromaWidth * h + w;
|
|
139
|
+
newIndex = newChromaWidth * h + w;
|
|
140
|
+
newUInt8Array[newIndex] = uUint8Array[oldIndex];
|
|
141
|
+
newVInt8Array[newIndex] = vUint8Array[oldIndex];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return Object.assign(Object.assign({}, imageData), { width: newWidth, height, yUint8Array: newYUint8Array, uUint8Array: newUInt8Array, vUint8Array: newVInt8Array });
|
|
145
|
+
}
|
|
146
|
+
return imageData;
|
|
147
|
+
}
|
|
112
148
|
drawFrame(imageData) {
|
|
113
149
|
if (!this.ready) {
|
|
114
150
|
this.ready = true;
|
|
115
151
|
this.event.emit('ready');
|
|
116
152
|
}
|
|
153
|
+
imageData = this._adjustImageData(imageData);
|
|
117
154
|
const mirror = 0;
|
|
118
155
|
const contentWidth = imageData.width;
|
|
119
156
|
const contentHeight = imageData.height;
|
package/liteav/trtc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, PluginInfo
|
|
3
|
+
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCVideoFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, PluginInfo } from './trtc_define';
|
|
4
4
|
export * from './trtc_define';
|
|
5
5
|
export * from './trtc_code';
|
|
6
6
|
/**
|
|
@@ -16,6 +16,7 @@ export * from './trtc_code';
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
declare class TRTCCloud extends EventEmitter {
|
|
19
|
+
private rtcCloud;
|
|
19
20
|
private streams;
|
|
20
21
|
private firstVideoFrameList;
|
|
21
22
|
private playStreamType;
|
|
@@ -38,7 +39,6 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
38
39
|
private audioQuality;
|
|
39
40
|
private bgmId;
|
|
40
41
|
private playAudioEffectIdList;
|
|
41
|
-
private isLocalPreviewStarted;
|
|
42
42
|
constructor();
|
|
43
43
|
/**
|
|
44
44
|
* 创建 TRTCCloud 对象单例
|
|
@@ -84,7 +84,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
84
84
|
* @param {Number} errCode - 错误码
|
|
85
85
|
* @param {String} errMsg - 错误信息
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
handleOnError(errCode: number, errMsg: string): void;
|
|
88
88
|
/**
|
|
89
89
|
* 1.2 警告回调:用于告知您一些非严重性问题,例如出现了卡顿或者可恢复的解码失败。
|
|
90
90
|
*
|
|
@@ -92,7 +92,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
92
92
|
* @param {Number} warningCode - 警告码
|
|
93
93
|
* @param {String} warningMsg - 警告信息
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
handleOnWarning(warningCode: number, warningMsg: string): void;
|
|
96
96
|
/**
|
|
97
97
|
* 2.1 已加入房间的回调
|
|
98
98
|
*
|
|
@@ -108,7 +108,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
108
108
|
* @event TRTCCallback#onEnterRoom
|
|
109
109
|
* @param {Number} result - result > 0 时为进房耗时(ms),result < 0 时为进房错误码。
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
handleOnEnterRoom(result: number): void;
|
|
112
112
|
/**
|
|
113
113
|
* 2.2 退出房间的事件回调
|
|
114
114
|
*
|
|
@@ -121,7 +121,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
121
121
|
* @event TRTCCallback#onExitRoom
|
|
122
122
|
* @param {Number} reason - 离开房间原因,0:主动调用 exitRoom 退房;1:被服务器踢出当前房间;2:当前房间整个被解散。
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
handleOnExitRoom(reason: number): void;
|
|
125
125
|
/**
|
|
126
126
|
* 2.3 切换房间的事件回调
|
|
127
127
|
*
|
|
@@ -129,7 +129,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
129
129
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
130
130
|
* @param {String} errMsg - 错误信息。
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
handleOnSwitchRoom(errCode: number, errMsg: string): void;
|
|
133
133
|
/**
|
|
134
134
|
* 2.4 切换角色的事件回调
|
|
135
135
|
*
|
|
@@ -140,7 +140,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
140
140
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
141
141
|
* @param {String} errMsg - 错误信息。
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
handleOnSwitchRole(errCode: number, errMsg: string): void;
|
|
144
144
|
/**
|
|
145
145
|
* 2.5 请求跨房连麦(主播跨房 PK)的结果回调
|
|
146
146
|
*
|
|
@@ -153,7 +153,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
153
153
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
154
154
|
* @param {String} errMsg - 错误信息。
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
handleOnConnectOtherRoom(userId: string, errCode: number, errMsg: string): void;
|
|
157
157
|
/**
|
|
158
158
|
* 2.6 关闭跨房连麦(主播跨房 PK)的结果回调
|
|
159
159
|
*
|
|
@@ -161,7 +161,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
161
161
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见 [错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
162
162
|
* @param {String} errMsg - 错误信息。
|
|
163
163
|
*/
|
|
164
|
-
|
|
164
|
+
handleOnDisconnectOtherRoom(errCode: number, errMsg: string): void;
|
|
165
165
|
/**
|
|
166
166
|
* 3.1 有用户加入当前房间
|
|
167
167
|
*
|
|
@@ -174,7 +174,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
174
174
|
* @event TRTCCallback#onRemoteUserEnterRoom
|
|
175
175
|
* @param {String} userId - 用户标识
|
|
176
176
|
*/
|
|
177
|
-
|
|
177
|
+
handleOnRemoteUserEnterRoom(userId: string): void;
|
|
178
178
|
/**
|
|
179
179
|
* 3.2 有用户离开当前房间
|
|
180
180
|
*
|
|
@@ -186,7 +186,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
186
186
|
* @param {String} userId - 用户标识
|
|
187
187
|
* @param {Number} reason - 离开原因,0表示用户主动退出房间,1表示用户超时退出,2表示被踢出房间。
|
|
188
188
|
*/
|
|
189
|
-
|
|
189
|
+
handleOnRemoteUserLeaveRoom(userId: string, reason: number): void;
|
|
190
190
|
/**
|
|
191
191
|
* 3.3 用户是否开启摄像头视频
|
|
192
192
|
*
|
|
@@ -201,7 +201,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
201
201
|
* @param {String} userId - 用户标识
|
|
202
202
|
* @param {Number} available - 画面是否开启
|
|
203
203
|
*/
|
|
204
|
-
|
|
204
|
+
handleOnUserVideoAvailable(userId: string, available: number): void;
|
|
205
205
|
/**
|
|
206
206
|
* 3.4 用户是否开启了辅路画面(TRTCVideoStreamTypeSub,一般用于屏幕分享)
|
|
207
207
|
*
|
|
@@ -211,7 +211,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
211
211
|
* @param {String} userId - 用户标识
|
|
212
212
|
* @param {Number} available - 辅路画面是否开启
|
|
213
213
|
*/
|
|
214
|
-
|
|
214
|
+
handleOnUserSubStreamAvailable(userId: string, available: number): void;
|
|
215
215
|
/**
|
|
216
216
|
* 3.5 用户是否开启音频上行
|
|
217
217
|
*
|
|
@@ -219,7 +219,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
219
219
|
* @param {String} userId - 用户标识
|
|
220
220
|
* @param {Number} available - 声音是否开启
|
|
221
221
|
*/
|
|
222
|
-
|
|
222
|
+
handleOnUserAudioAvailable(userId: string, available: number): void;
|
|
223
223
|
/**
|
|
224
224
|
* 3.6 开始渲染本地或远程用户的首帧画面
|
|
225
225
|
*
|
|
@@ -234,14 +234,14 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
234
234
|
* @param {Number} width - 画面宽度
|
|
235
235
|
* @param {Number} height - 画面高度
|
|
236
236
|
*/
|
|
237
|
-
|
|
237
|
+
handleOnFirstVideoFrame(userId: string, streamType: number, width: number, height: number): void;
|
|
238
238
|
/**
|
|
239
239
|
* 3.7 开始播放远程用户的首帧音频(本地声音暂不通知)
|
|
240
240
|
*
|
|
241
241
|
* @event TRTCCallback#onFirstAudioFrame
|
|
242
242
|
* @param {String} userId - 远程用户 ID。
|
|
243
243
|
*/
|
|
244
|
-
|
|
244
|
+
handleOnFirstAudioFrame(userId: string): void;
|
|
245
245
|
/**
|
|
246
246
|
* 3.8 首帧本地视频数据已经被送出
|
|
247
247
|
*
|
|
@@ -251,7 +251,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
251
251
|
* @event TRTCCallback#onSendFirstLocalVideoFrame
|
|
252
252
|
* @param {Number} streamType - - 视频流类型,TRTCVideoStreamTypeBig:主路画面,一般用于摄像头;TRTCVideoStreamTypeSub:辅路画面,一般用于屏幕分享。
|
|
253
253
|
*/
|
|
254
|
-
|
|
254
|
+
handleOnSendFirstLocalVideoFrame(streamType: number): void;
|
|
255
255
|
/**
|
|
256
256
|
* 3.9 首帧本地音频数据已经被送出
|
|
257
257
|
*
|
|
@@ -260,7 +260,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
260
260
|
*
|
|
261
261
|
* @event TRTCCallback#onSendFirstLocalAudioFrame
|
|
262
262
|
*/
|
|
263
|
-
|
|
263
|
+
handleOnSendFirstLocalAudioFrame(): void;
|
|
264
264
|
/**
|
|
265
265
|
* 3.10 废弃事件:有主播加入当前房间
|
|
266
266
|
*
|
|
@@ -270,7 +270,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
270
270
|
* @event TRTCCallback#onUserEnter
|
|
271
271
|
* @param {String} userId - 用户标识
|
|
272
272
|
*/
|
|
273
|
-
|
|
273
|
+
handleOnUserEnter(userId: string): void;
|
|
274
274
|
/**
|
|
275
275
|
* 3.11 废弃事件:有主播离开当前房间
|
|
276
276
|
*
|
|
@@ -281,7 +281,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
281
281
|
* @param {String} userId - 用户标识
|
|
282
282
|
* @param {Number} reason - 离开原因代码,区分用户是正常离开,还是由于网络断线等原因离开。
|
|
283
283
|
*/
|
|
284
|
-
|
|
284
|
+
handleOnUserExit(userId: string, reason: number): void;
|
|
285
285
|
/**
|
|
286
286
|
* 4.1 网络质量:该回调每2秒触发一次,统计当前网络的上行和下行质量
|
|
287
287
|
*
|
|
@@ -309,23 +309,21 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
309
309
|
*
|
|
310
310
|
* @event TRTCCallback#onConnectionLost
|
|
311
311
|
*/
|
|
312
|
-
|
|
312
|
+
handleOnConnectionLost(): void;
|
|
313
313
|
/**
|
|
314
314
|
* 5.2 SDK 尝试重新连接到服务器
|
|
315
315
|
*
|
|
316
316
|
* @event TRTCCallback#onTryToReconnect
|
|
317
317
|
*/
|
|
318
|
-
|
|
318
|
+
handleOnTryToReconnect(): void;
|
|
319
319
|
/**
|
|
320
320
|
* 5.3 SDK 跟服务器的连接恢复
|
|
321
321
|
*
|
|
322
322
|
* @event TRTCCallback#onConnectionRecovery
|
|
323
323
|
*/
|
|
324
|
-
|
|
324
|
+
handleOnConnectionRecovery(): void;
|
|
325
325
|
/**
|
|
326
|
-
* 5.4
|
|
327
|
-
*
|
|
328
|
-
* @deprecated 从 TRTCSDK 9.3 后该接口已被废弃,不会抛出该事件, 请采用 onSpeedTestResult 事件代替
|
|
326
|
+
* 5.4 服务器测速的回调,SDK 对多个服务器 IP 做测速,每个 IP 的测速结果通过这个回调通知
|
|
329
327
|
*
|
|
330
328
|
* @event TRTCCallback#onSpeedTest
|
|
331
329
|
* @param {TRTCSpeedTestResult} currentResult - 当前完成的测速结果
|
|
@@ -333,27 +331,18 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
333
331
|
* @param {Number} totalCount - 需要测速的服务器总数量
|
|
334
332
|
*/
|
|
335
333
|
bindOnSpeedTest(): void;
|
|
336
|
-
/**
|
|
337
|
-
* 5.5 网速测试的结果回调
|
|
338
|
-
*
|
|
339
|
-
* 该统计回调由 startSpeedTest 触发。
|
|
340
|
-
*
|
|
341
|
-
* @event TRTCCallback#onSpeedTestResult
|
|
342
|
-
* @param {TRTCSpeedTestResult} result 网速测试数据数据,包括丢包、往返延迟、上下行的带宽速率。
|
|
343
|
-
*/
|
|
344
|
-
bindOnSpeedTestResult(): void;
|
|
345
334
|
/**
|
|
346
335
|
* 6.1 摄像头准备就绪
|
|
347
336
|
*
|
|
348
337
|
* @event TRTCCallback#onCameraDidReady
|
|
349
338
|
*/
|
|
350
|
-
|
|
339
|
+
handleOnCameraDidReady(): void;
|
|
351
340
|
/**
|
|
352
341
|
* 6.2 麦克风准备就绪
|
|
353
342
|
*
|
|
354
343
|
* @event TRTCCallback#onMicDidReady
|
|
355
344
|
*/
|
|
356
|
-
|
|
345
|
+
handleOnMicDidReady(): void;
|
|
357
346
|
/**
|
|
358
347
|
* 6.3 userId 对应的成员语音音量
|
|
359
348
|
*
|
|
@@ -375,7 +364,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
375
364
|
* @param {TRTCDeviceType} type - 设备类型
|
|
376
365
|
* @param {TRTCDeviceState} state - 事件类型
|
|
377
366
|
*/
|
|
378
|
-
|
|
367
|
+
handleOnDeviceChange(deviceId: string, type: TRTCDeviceType, state: TRTCDeviceState): void;
|
|
379
368
|
/**
|
|
380
369
|
* 6.5 麦克风测试音量回调
|
|
381
370
|
*
|
|
@@ -384,7 +373,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
384
373
|
* @event TRTCCallback#onTestMicVolume
|
|
385
374
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
386
375
|
*/
|
|
387
|
-
|
|
376
|
+
handleOnTestMicVolume(volume: number): void;
|
|
388
377
|
/**
|
|
389
378
|
* 6.6 扬声器测试音量回调
|
|
390
379
|
*
|
|
@@ -393,7 +382,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
393
382
|
* @event TRTCCallback#onTestSpeakerVolume
|
|
394
383
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
395
384
|
*/
|
|
396
|
-
|
|
385
|
+
handleOnTestSpeakerVolume(volume: number): void;
|
|
397
386
|
/**
|
|
398
387
|
* 6.7 当前音频采集设备音量变化回调
|
|
399
388
|
*
|
|
@@ -403,7 +392,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
403
392
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
404
393
|
* @param {Boolean} muted - 当前采集音频设备是否被静音
|
|
405
394
|
*/
|
|
406
|
-
|
|
395
|
+
handleOnAudioDeviceCaptureVolumeChanged(volume: number, muted: number): void;
|
|
407
396
|
/**
|
|
408
397
|
* 6.8 当前音频播放设备音量变化回调
|
|
409
398
|
*
|
|
@@ -413,7 +402,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
413
402
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
414
403
|
* @param {Boolean} muted - 当前音频播放设备是否被静音
|
|
415
404
|
*/
|
|
416
|
-
|
|
405
|
+
handleOnAudioDevicePlayoutVolumeChanged(volume: number, muted: number): void;
|
|
417
406
|
/**
|
|
418
407
|
* 7.1 收到自定义消息回调
|
|
419
408
|
*
|
|
@@ -458,7 +447,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
458
447
|
* @param {Number} errCode - 0表示成功,其余值表示失败
|
|
459
448
|
* @param {String} errMsg - 具体错误原因
|
|
460
449
|
*/
|
|
461
|
-
|
|
450
|
+
handleOnStartPublishing(errCode: number, errMsg: string): void;
|
|
462
451
|
/**
|
|
463
452
|
* 8.2 停止向腾讯云的直播 CDN 推流的回调,对应于 TRTCCloud 中的 [stopPublishing()]{@link TRTCCloud#stopPublishing} 接口
|
|
464
453
|
*
|
|
@@ -466,7 +455,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
466
455
|
* @param {Number} errCode - 0表示成功,其余值表示失败
|
|
467
456
|
* @param {String} errMsg - 具体错误原因
|
|
468
457
|
*/
|
|
469
|
-
|
|
458
|
+
handleOnStopPublishing(errCode: number, errMsg: string): void;
|
|
470
459
|
/**
|
|
471
460
|
* 8.3 旁路推流到 CDN 的回调
|
|
472
461
|
*
|
|
@@ -478,7 +467,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
478
467
|
* @param {Number} errCode - 错误码
|
|
479
468
|
* @param {String} errMsg - 错误详细信息
|
|
480
469
|
*/
|
|
481
|
-
|
|
470
|
+
handleOnStartPublishCDNStream(errCode: number, errMsg: string): void;
|
|
482
471
|
/**
|
|
483
472
|
* 8.4 停止旁路推流到 CDN 的回调
|
|
484
473
|
*
|
|
@@ -488,7 +477,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
488
477
|
* @param {Number} errCode - 错误码
|
|
489
478
|
* @param {String} errMsg - 错误详细信息
|
|
490
479
|
*/
|
|
491
|
-
|
|
480
|
+
handleOnStopPublishCDNStream(errCode: number, errMsg: string): void;
|
|
492
481
|
/**
|
|
493
482
|
* 8.5 设置云端的混流转码参数的回调
|
|
494
483
|
*
|
|
@@ -498,7 +487,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
498
487
|
* @param {Number} errCode - 错误码
|
|
499
488
|
* @param {String} errMsg - 错误详细信息
|
|
500
489
|
*/
|
|
501
|
-
|
|
490
|
+
handleOnSetMixTranscodingConfig(errCode: number, errMsg: string): void;
|
|
502
491
|
/**
|
|
503
492
|
* 9.1 废弃事件: 播放音效结束回调
|
|
504
493
|
*
|
|
@@ -508,40 +497,40 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
508
497
|
* @param {Number} effectId - 音效 ID
|
|
509
498
|
* @param {Number} code - 0表示播放正常结束;其他表示异常结束
|
|
510
499
|
*/
|
|
511
|
-
|
|
500
|
+
handleOnAudioEffectFinished(effectId: number, code: number): void;
|
|
512
501
|
/**
|
|
513
502
|
* 10.1 当屏幕分享窗口被遮挡无法正常捕获时,SDK 会通过此回调通知,可在此回调里通知用户移开遮挡窗口
|
|
514
503
|
*
|
|
515
504
|
* @event TRTCCallback#onScreenCaptureCovered
|
|
516
505
|
*/
|
|
517
|
-
|
|
506
|
+
handleOnScreenCaptureCovered(): void;
|
|
518
507
|
/**
|
|
519
508
|
* 10.2 当屏幕分享开始时,SDK 会通过此回调通知
|
|
520
509
|
*
|
|
521
510
|
* @event TRTCCallback#onScreenCaptureStarted
|
|
522
511
|
*/
|
|
523
|
-
|
|
512
|
+
handleOnScreenCaptureStarted(): void;
|
|
524
513
|
/**
|
|
525
514
|
* 10.3 当屏幕分享暂停时,SDK 会通过此回调通知
|
|
526
515
|
*
|
|
527
516
|
* @event TRTCCallback#onScreenCapturePaused
|
|
528
517
|
* @param {Number} reason - 停止原因,0:表示用户主动暂停;1:表示设置屏幕分享参数导致的暂停;2:表示屏幕分享窗口被最小化导致的暂停;3:表示屏幕分享窗口被隐藏导致的暂停
|
|
529
518
|
*/
|
|
530
|
-
|
|
519
|
+
handleOnScreenCapturePaused(reason: number): void;
|
|
531
520
|
/**
|
|
532
521
|
* 10.4 当屏幕分享恢复时,SDK 会通过此回调通知
|
|
533
522
|
*
|
|
534
523
|
* @event TRTCCallback#onScreenCaptureResumed
|
|
535
524
|
* @param {Number} reason - 停止原因,0:表示用户主动恢复,1:表示屏幕分享参数设置完毕后自动恢复;2:表示屏幕分享窗口从最小化被恢复;3:表示屏幕分享窗口从隐藏被恢复
|
|
536
525
|
*/
|
|
537
|
-
|
|
526
|
+
handleOnScreenCaptureResumed(reason: number): void;
|
|
538
527
|
/**
|
|
539
528
|
* 10.5 当屏幕分享停止时,SDK 会通过此回调通知
|
|
540
529
|
*
|
|
541
530
|
* @event TRTCCallback#onScreenCaptureStopped
|
|
542
531
|
* @param {Number} reason - 停止原因,0:表示用户主动停止;1:表示屏幕分享窗口被关闭
|
|
543
532
|
*/
|
|
544
|
-
|
|
533
|
+
handleOnScreenCaptureStopped(reason: number): void;
|
|
545
534
|
/**
|
|
546
535
|
* 11.1 截图完成时回调
|
|
547
536
|
*
|
|
@@ -553,7 +542,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
553
542
|
* @param {Number} width - 截图画面的宽度
|
|
554
543
|
* @param {Number} height - 截图画面的高度
|
|
555
544
|
*/
|
|
556
|
-
|
|
545
|
+
handleOnSnapshotComplete(userId: string, type: TRTCVideoStreamType, buffer: ArrayBuffer, width: number, height: number): void;
|
|
557
546
|
/**
|
|
558
547
|
* 12.1 废弃事件: 开始播放背景音乐
|
|
559
548
|
*
|
|
@@ -562,8 +551,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
562
551
|
* @event TRTCCallback#onPlayBGMBegin
|
|
563
552
|
* @param {Number} errCode - 错误码
|
|
564
553
|
*/
|
|
565
|
-
|
|
566
|
-
bindOnMusicStart(): void;
|
|
554
|
+
handleOnPlayBGMBegin(errCode: number): void;
|
|
567
555
|
/**
|
|
568
556
|
* 12.2 废弃事件: 播放背景音乐的进度
|
|
569
557
|
*
|
|
@@ -573,8 +561,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
573
561
|
* @param {Number} progressMS - 已播放时间
|
|
574
562
|
* @param {Number} durationMS - 总时间
|
|
575
563
|
*/
|
|
576
|
-
|
|
577
|
-
bindOnMusicPlayProgress(): void;
|
|
564
|
+
handleOnPlayBGMProgress(progressMS: number, durationMS: number): void;
|
|
578
565
|
/**
|
|
579
566
|
* 12.3 废弃事件: 播放背景音乐结束
|
|
580
567
|
*
|
|
@@ -583,8 +570,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
583
570
|
* @event TRTCCallback#onPlayBGMComplete
|
|
584
571
|
* @param {Number} errCode - 错误码
|
|
585
572
|
*/
|
|
586
|
-
|
|
587
|
-
bindOnMusicComplete(): void;
|
|
573
|
+
handleOnPlayBGMComplete(errCode: number): void;
|
|
588
574
|
/**
|
|
589
575
|
* 13.1 系统音频采集回调
|
|
590
576
|
*
|
|
@@ -596,7 +582,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
596
582
|
* - ERR_AUDIO_PLUGIN_INSTALL_NOT_AUTHORIZED (-1331) :未授权安装音频驱动插件
|
|
597
583
|
* - ERR_AUDIO_PLUGIN_INSTALL_FAILED (-1332) :安装音频驱动插件失败
|
|
598
584
|
*/
|
|
599
|
-
|
|
585
|
+
handleOnSystemAudioLoopbackError(errCode: number): void;
|
|
600
586
|
/**
|
|
601
587
|
* 1.1 进入房间
|
|
602
588
|
*
|
|
@@ -855,19 +841,12 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
855
841
|
*/
|
|
856
842
|
stopLocalPreview(): void;
|
|
857
843
|
/**
|
|
858
|
-
* 3.3
|
|
859
|
-
*
|
|
860
|
-
* 该接口可以暂停(或恢复)发布本地的视频画面,暂停之后,同一房间中的其他用户将无法继续看到自己画面。
|
|
861
|
-
* 该接口在指定 TRTCVideoStreamTypeBig 时等效于 start/stopLocalPreview 这两个接口,但具有更好的响应速度。
|
|
862
|
-
* 因为 start/stopLocalPreview 需要打开和关闭摄像头,而打开和关闭摄像头都是硬件设备相关的操作,非常耗时。
|
|
863
|
-
* 相比之下,muteLocalVideo 只需要在软件层面对数据流进行暂停或者放行即可,因此效率更高,也更适合需要频繁打开关闭的场景。
|
|
864
|
-
* 当暂停/恢复发布指定 TRTCVideoStreamTypeBig 后,同一房间中的其他用户将会收到 onUserVideoAvailable 回调通知。
|
|
865
|
-
* 当暂停/恢复发布指定 TRTCVideoStreamTypeSub 后,同一房间中的其他用户将会收到 onUserSubStreamAvailable 回调通知。
|
|
844
|
+
* 3.3 是否屏蔽自己的视频画面
|
|
866
845
|
*
|
|
867
|
-
*
|
|
868
|
-
* @param {
|
|
846
|
+
* 当屏蔽本地视频后,房间里的其它成员将会收到 onUserVideoAvailable 回调通知
|
|
847
|
+
* @param {Boolean} mute - true:屏蔽;false:开启,默认值:false
|
|
869
848
|
*/
|
|
870
|
-
muteLocalVideo(mute: boolean
|
|
849
|
+
muteLocalVideo(mute: boolean): void;
|
|
871
850
|
/**
|
|
872
851
|
* 3.4 开始显示远端视频画面
|
|
873
852
|
*
|
|
@@ -903,9 +882,8 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
903
882
|
*
|
|
904
883
|
* @param {String} userId - 对方的用户标识
|
|
905
884
|
* @param {Boolean} mute - 是否停止接收
|
|
906
|
-
* @param {TRTCVideoStreamType} streamType - 视频流类型
|
|
907
885
|
*/
|
|
908
|
-
muteRemoteVideoStream(userId: string, mute: boolean
|
|
886
|
+
muteRemoteVideoStream(userId: string, mute: boolean): void;
|
|
909
887
|
/**
|
|
910
888
|
* 3.8 停止接收所有远端视频流
|
|
911
889
|
*
|
|
@@ -1184,15 +1162,10 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1184
1162
|
* 注意:录音文件路径需精确到文件名及格式后缀,格式后缀决定录制文件的格式。
|
|
1185
1163
|
* 例如:指定路径为 path/to/audio.aac,则会生成一个 AAC 格式的文件。目前支持的格式有 PCM, WAV, AAC
|
|
1186
1164
|
*
|
|
1187
|
-
* @
|
|
1188
|
-
* @params {String} params.filePath - 文件路径(必填),录音文件的保存路径。该路径需要用户自行指定,请确保路径存在且可写
|
|
1189
|
-
* @params {TRTCAudioRecordingContent} params.recordingContent - 音频录制内容类型
|
|
1165
|
+
* @param {String} path - 录音文件路径(必填),录音文件的保存路径,该路径需要用户自行指定,请确保路径存在且可写。
|
|
1190
1166
|
* @return {Number} 0:成功;-1:录音已开始;-2:文件或目录创建失败;-3:后缀指定的音频格式不支持
|
|
1191
|
-
*
|
|
1192
|
-
* 注意:
|
|
1193
|
-
* - 在 9.3 之前的版本,params 为 string 代表 录音文件路径(必填), 9.3 以及以后同时支持 string 类型和 TRTCAudioRecordingParams。
|
|
1194
1167
|
*/
|
|
1195
|
-
startAudioRecording(
|
|
1168
|
+
startAudioRecording(path: string): number;
|
|
1196
1169
|
/**
|
|
1197
1170
|
* 4.13 停止录音
|
|
1198
1171
|
*
|
|
@@ -1216,7 +1189,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1216
1189
|
* 5.1 获取摄像头设备列表
|
|
1217
1190
|
*
|
|
1218
1191
|
* @example
|
|
1219
|
-
* var cameralist = rtcCloud.getCameraDevicesList();
|
|
1192
|
+
* var cameralist = this.rtcCloud.getCameraDevicesList();
|
|
1220
1193
|
* for (i=0;i<cameralist.length;i++) {
|
|
1221
1194
|
* var camera = cameralist[i];
|
|
1222
1195
|
* console.info("camera deviceName: " + camera.deviceName + " deviceId:" + camera.deviceId);
|
|
@@ -1240,7 +1213,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1240
1213
|
* 6.1 获取麦克风设备列表
|
|
1241
1214
|
*
|
|
1242
1215
|
* @example
|
|
1243
|
-
* var miclist = rtcCloud.getMicDevicesList();
|
|
1216
|
+
* var miclist = this.rtcCloud.getMicDevicesList();
|
|
1244
1217
|
* for (i=0;i<miclist.length;i++) {
|
|
1245
1218
|
* var mic = miclist[i];
|
|
1246
1219
|
* console.info("mic deviceName: " + mic.deviceName + " deviceId:" + mic.deviceId);
|
|
@@ -1292,7 +1265,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1292
1265
|
* 6.8 获取扬声器设备列表
|
|
1293
1266
|
*
|
|
1294
1267
|
* @example
|
|
1295
|
-
* var speakerlist = rtcCloud.getSpeakerDevicesList();
|
|
1268
|
+
* var speakerlist = this.rtcCloud.getSpeakerDevicesList();
|
|
1296
1269
|
* for (i=0;i<speakerlist.length;i++) {
|
|
1297
1270
|
* var speaker = speakerlist[i];
|
|
1298
1271
|
* console.info("mic deviceName: " + speaker.deviceName + " deviceId:" + speaker.deviceId);
|
|
@@ -1457,11 +1430,6 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1457
1430
|
* - 共享整个窗口:sourceInfoList 中 type 为 Window 的 source,captureRect 设为 { 0, 0, 0, 0 }
|
|
1458
1431
|
* - 共享窗口区域:sourceInfoList 中 type 为 Window 的 source,captureRect 设为非 NULL,例如 { 100, 100, 300, 300 }
|
|
1459
1432
|
*
|
|
1460
|
-
* @param {TRTCScreenCaptureSourceInfo} source - 指定分享源,详情参考TRTCScreenCaptureSourceInfo 定义
|
|
1461
|
-
* @param {Rect} captureRect - 指定捕获的区域
|
|
1462
|
-
* @param {TRTCScreenCaptureProperty} property - 指定屏幕分享目标的属性,包括捕获鼠标,高亮捕获窗口等,详情参考TRTCScreenCaptureProperty 定义
|
|
1463
|
-
*
|
|
1464
|
-
* 废弃参数使用方法(针对 9.3 以下版本):
|
|
1465
1433
|
* @param {TRTCScreenCaptureSourceType} type - 采集源类型
|
|
1466
1434
|
* - TRTCScreenCaptureSourceTypeWindow: 该分享目标是某一个Windows窗口
|
|
1467
1435
|
* - TRTCScreenCaptureSourceTypeScreen: 该分享目标是整个Windows桌面
|
|
@@ -1476,7 +1444,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1476
1444
|
* @param {Boolean} captureMouse - 指定是否捕获鼠标指针
|
|
1477
1445
|
* @param {Boolean} highlightWindow - 指定是否高亮正在共享的窗口,以及当捕获图像被遮挡时高亮遮挡窗口提示用户移走遮挡
|
|
1478
1446
|
*/
|
|
1479
|
-
selectScreenCaptureTarget(
|
|
1447
|
+
selectScreenCaptureTarget(type: number, sourceId: string, sourcename: string, captureRect: Rect, captureMouse: boolean, highlightWindow: boolean): any;
|
|
1480
1448
|
/**
|
|
1481
1449
|
* 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。
|
|
1482
1450
|
*
|
|
@@ -1550,6 +1518,28 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1550
1518
|
* @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
|
|
1551
1519
|
*/
|
|
1552
1520
|
removeAllExcludedShareWindow(): void;
|
|
1521
|
+
/**
|
|
1522
|
+
* 8.16 将指定窗口加入屏幕分享的包含列表中(该接口仅支持桌面系统)
|
|
1523
|
+
*
|
|
1524
|
+
* @param {String} win - 希望被分享出去的窗口(Windows 平台下为窗口句柄: HWND)
|
|
1525
|
+
* - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
|
|
1526
|
+
* - 您在 startScreenCapture 之前和之后调用均可。
|
|
1527
|
+
* - 通过该方法添加到包含列表中的窗口,会在退出房间后被 SDK 自动清除。
|
|
1528
|
+
*/
|
|
1529
|
+
addIncludedShareWindow(win: string): void;
|
|
1530
|
+
/**
|
|
1531
|
+
* 8.17 将指定窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
|
|
1532
|
+
*
|
|
1533
|
+
* @param {String} win - 希望被分享出去的窗口(Mac 平台: 窗口 ID;Windows 平台: HWND)
|
|
1534
|
+
* - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
|
|
1535
|
+
*/
|
|
1536
|
+
removeIncludedShareWindow(win: string): void;
|
|
1537
|
+
/**
|
|
1538
|
+
* 8.18 将全部窗口从屏幕分享的包含列表中移除(该接口仅支持桌面系统)
|
|
1539
|
+
*
|
|
1540
|
+
* @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeWindow 时生效,即分享窗口内容时,额外包含指定窗口的功能才生效。
|
|
1541
|
+
*/
|
|
1542
|
+
removeAllIncludedShareWindow(): void;
|
|
1553
1543
|
/**
|
|
1554
1544
|
* @private
|
|
1555
1545
|
* 9.5 设置本地视频自定义渲染(Electron 平台下不可用)
|
|
@@ -1873,21 +1863,13 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1873
1863
|
* 测速结果将会用于优化 SDK 接下来的服务器选择策略,因此推荐您在用户首次通话前先进行一次测速,这将有助于我们选择最佳的服务器。
|
|
1874
1864
|
* 同时,如果测试结果非常不理想,您可以通过醒目的 UI 提示用户选择更好的网络。
|
|
1875
1865
|
*
|
|
1876
|
-
*
|
|
1877
|
-
* 1. 测速过程将产生少量的基础服务费用,详见 [计费概述 > 基础服务](https://cloud.tencent.com/document/product/647/17157#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1) 文档说明。
|
|
1878
|
-
* 2. 请在进入房间前进行网速测试,在房间中网速测试会影响正常的音视频传输效果,而且由于干扰过多,网速测试结果也不准确。
|
|
1879
|
-
* 3. 同一时间只允许一项网速测试任务运行。
|
|
1880
|
-
*
|
|
1881
|
-
* @param {TRTCSpeedTestParams} params - 测速参数
|
|
1882
|
-
* @param {Number} params.sdkAppId - 应用标识
|
|
1883
|
-
* @param {String} params.userId - 用户标识
|
|
1884
|
-
* @param {String} params.userSig - 用户签名
|
|
1885
|
-
* @param {Number} params.expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
|
|
1886
|
-
* @param {Number} params.expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
|
|
1866
|
+
* 注意:测速过程将产生少量的基础服务费用,详见 [计费概述 > 基础服务](https://cloud.tencent.com/document/product/647/17157#.E5.9F.BA.E7.A1.80.E6.9C.8D.E5.8A.A1) 文档说明。
|
|
1887
1867
|
*
|
|
1888
|
-
* @
|
|
1868
|
+
* @param {Number} sdkAppId - 应用标识
|
|
1869
|
+
* @param {String} userId - 用户标识
|
|
1870
|
+
* @param {String} userSig - 用户签名
|
|
1889
1871
|
*/
|
|
1890
|
-
startSpeedTest(
|
|
1872
|
+
startSpeedTest(sdkAppId: number, userId: string, userSig: string): void;
|
|
1891
1873
|
/**
|
|
1892
1874
|
* 13.2 停止网络测速
|
|
1893
1875
|
*/
|
|
@@ -2045,6 +2027,5 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
2045
2027
|
_YUV2RGBA(width: number, height: number, buffer: ArrayBufferLike): Uint8ClampedArray;
|
|
2046
2028
|
_BGRA2RGBA(data: ArrayBuffer, width: number, height: number): Uint8ClampedArray;
|
|
2047
2029
|
_isMacPlatform(): boolean;
|
|
2048
|
-
_isLocalUser(uid: string): boolean;
|
|
2049
2030
|
}
|
|
2050
2031
|
export default TRTCCloud;
|