trtc-electron-sdk 9.3.201 → 9.3.301
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/trtc.d.ts +68 -108
- package/liteav/trtc.js +453 -560
- package/liteav/trtc_define.d.ts +12 -84
- package/liteav/trtc_define.js +12 -122
- package/package.json +1 -1
package/liteav/trtc.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -28,7 +32,6 @@ __exportStar(require("./trtc_code"), exports);
|
|
|
28
32
|
// 监听该事件,返回自定义视频渲染数据 ( bgra 格式)
|
|
29
33
|
const CUSTOM_VIDEO_DATA = 'onVideoData';
|
|
30
34
|
const SDK_LOG_LEVEL = 2;
|
|
31
|
-
const EMPTY_VIEW = 0;
|
|
32
35
|
let genSecFunc = function (instance, key) {
|
|
33
36
|
return function () {
|
|
34
37
|
let param = Array.from(arguments);
|
|
@@ -77,10 +80,7 @@ let formatLogParams = function (params) {
|
|
|
77
80
|
return logParamsStr;
|
|
78
81
|
};
|
|
79
82
|
let trtcCloudInstance = null;
|
|
80
|
-
let
|
|
81
|
-
let onMusicStartCb = null;
|
|
82
|
-
let onMusicPlayProgressCb = null;
|
|
83
|
-
let onMusicPlayCompleteCb = null;
|
|
83
|
+
let oriRtcCloud = null;
|
|
84
84
|
/**
|
|
85
85
|
* 腾讯云视频通话功能的主要接口类
|
|
86
86
|
*
|
|
@@ -96,7 +96,10 @@ let onMusicPlayCompleteCb = null;
|
|
|
96
96
|
class TRTCCloud extends events_1.EventEmitter {
|
|
97
97
|
constructor() {
|
|
98
98
|
super();
|
|
99
|
-
|
|
99
|
+
oriRtcCloud = new trtc.NodeRTCCloud(pkg.version);
|
|
100
|
+
this.rtcCloud = Object.assign({}, oriRtcCloud, {
|
|
101
|
+
onlineLog: undefined
|
|
102
|
+
});
|
|
100
103
|
this.streams = new Map();
|
|
101
104
|
this.firstVideoFrameList = [];
|
|
102
105
|
this.playStreamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
@@ -117,10 +120,10 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
117
120
|
// 生成一个足够大, 不会与用户输入重复的 id
|
|
118
121
|
this.bgmId = 1 << 29;
|
|
119
122
|
this.playAudioEffectIdList = [];
|
|
120
|
-
this.
|
|
123
|
+
this.enableRenderFrame = true;
|
|
121
124
|
this.initEventHandler();
|
|
122
125
|
console.log('constructor render:' + this.renderMode + '|sdk version:' + pkg.version +
|
|
123
|
-
'|native sdk version:' + rtcCloud.getSDKVersion());
|
|
126
|
+
'|native sdk version:' + this.rtcCloud.getSDKVersion());
|
|
124
127
|
//视频数据回调
|
|
125
128
|
this.imageData = null;
|
|
126
129
|
//VideoCallback 本地和远程
|
|
@@ -162,10 +165,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
162
165
|
*/
|
|
163
166
|
destroy() {
|
|
164
167
|
this.firstVideoFrameList = [];
|
|
165
|
-
this.isLocalPreviewStarted = false;
|
|
166
168
|
this.playAudioEffectIdList = [];
|
|
167
|
-
rtcCloud.destroy();
|
|
168
|
-
rtcCloud = null;
|
|
169
|
+
this.rtcCloud.destroy();
|
|
169
170
|
}
|
|
170
171
|
/////////////////////////////////////////////////////////////////////////////////
|
|
171
172
|
//
|
|
@@ -190,69 +191,162 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
190
191
|
* @namespace TRTCCallback
|
|
191
192
|
*/
|
|
192
193
|
initEventHandler() {
|
|
193
|
-
rtcCloud.onEvent('apierror', (funcName) => {
|
|
194
|
+
this.rtcCloud.onEvent('apierror', (funcName) => {
|
|
194
195
|
console.error(`api ${funcName} failed. this is an error
|
|
195
196
|
thrown by c++ addon layer. it often means sth is
|
|
196
197
|
going wrong with this function call and it refused
|
|
197
198
|
to do what is asked. kindly check your parameter types
|
|
198
199
|
to see if it matches properly.`);
|
|
199
200
|
});
|
|
200
|
-
|
|
201
|
-
this.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
201
|
+
// 严格按时序回调的函数都在这里触发
|
|
202
|
+
this.rtcCloud.setSpecialEventCallback((key, int32_1, int32_2, int32_3, uint32_1, uint32_2, string_1, string_2, buff) => {
|
|
203
|
+
switch (key) {
|
|
204
|
+
case 'onError':
|
|
205
|
+
this.handleOnError(int32_1, string_1);
|
|
206
|
+
break;
|
|
207
|
+
case 'onWarning':
|
|
208
|
+
this.handleOnWarning(int32_1, string_1);
|
|
209
|
+
break;
|
|
210
|
+
case 'onEnterRoom':
|
|
211
|
+
this.handleOnEnterRoom(int32_1);
|
|
212
|
+
break;
|
|
213
|
+
case 'onExitRoom':
|
|
214
|
+
this.handleOnExitRoom(int32_1);
|
|
215
|
+
break;
|
|
216
|
+
case 'onSwitchRoom':
|
|
217
|
+
this.handleOnSwitchRoom(int32_1, string_1);
|
|
218
|
+
break;
|
|
219
|
+
case 'onSwitchRole':
|
|
220
|
+
this.handleOnSwitchRole(int32_1, string_1);
|
|
221
|
+
break;
|
|
222
|
+
case 'onConnectOtherRoom':
|
|
223
|
+
this.handleOnConnectOtherRoom(string_1, int32_1, string_2);
|
|
224
|
+
break;
|
|
225
|
+
case 'onDisconnectOtherRoom':
|
|
226
|
+
this.handleOnDisconnectOtherRoom(int32_1, string_1);
|
|
227
|
+
break;
|
|
228
|
+
case 'onRemoteUserEnterRoom':
|
|
229
|
+
this.handleOnRemoteUserEnterRoom(string_1);
|
|
230
|
+
break;
|
|
231
|
+
case 'onRemoteUserLeaveRoom':
|
|
232
|
+
this.handleOnRemoteUserLeaveRoom(string_1, int32_1);
|
|
233
|
+
break;
|
|
234
|
+
case 'onUserVideoAvailable':
|
|
235
|
+
this.handleOnUserVideoAvailable(string_1, int32_1);
|
|
236
|
+
break;
|
|
237
|
+
case 'onUserSubStreamAvailable':
|
|
238
|
+
this.handleOnUserSubStreamAvailable(string_1, int32_1);
|
|
239
|
+
break;
|
|
240
|
+
case 'onUserAudioAvailable':
|
|
241
|
+
this.handleOnUserAudioAvailable(string_1, int32_1);
|
|
242
|
+
break;
|
|
243
|
+
case 'onFirstVideoFrame':
|
|
244
|
+
this.handleOnFirstVideoFrame(string_1, int32_1, int32_2, int32_3);
|
|
245
|
+
break;
|
|
246
|
+
case 'onFirstAudioFrame':
|
|
247
|
+
this.handleOnFirstAudioFrame(string_1);
|
|
248
|
+
break;
|
|
249
|
+
case 'onSendFirstLocalVideoFrame':
|
|
250
|
+
this.handleOnSendFirstLocalVideoFrame(int32_1);
|
|
251
|
+
break;
|
|
252
|
+
case 'onSendFirstLocalAudioFrame':
|
|
253
|
+
this.handleOnSendFirstLocalAudioFrame();
|
|
254
|
+
break;
|
|
255
|
+
case 'onUserEnter':
|
|
256
|
+
this.handleOnUserEnter(string_1);
|
|
257
|
+
break;
|
|
258
|
+
case 'onUserExit':
|
|
259
|
+
this.handleOnUserExit(string_1, int32_1);
|
|
260
|
+
break;
|
|
261
|
+
case 'onConnectionLost':
|
|
262
|
+
this.handleOnConnectionLost();
|
|
263
|
+
break;
|
|
264
|
+
case 'onTryToReconnect':
|
|
265
|
+
this.handleOnTryToReconnect();
|
|
266
|
+
break;
|
|
267
|
+
case 'onConnectionRecovery':
|
|
268
|
+
this.handleOnConnectionRecovery();
|
|
269
|
+
break;
|
|
270
|
+
case 'onCameraDidReady':
|
|
271
|
+
this.handleOnCameraDidReady();
|
|
272
|
+
break;
|
|
273
|
+
case 'onMicDidReady':
|
|
274
|
+
this.handleOnMicDidReady();
|
|
275
|
+
break;
|
|
276
|
+
case 'onDeviceChange':
|
|
277
|
+
this.handleOnDeviceChange(string_1, int32_1, int32_2);
|
|
278
|
+
break;
|
|
279
|
+
case 'onTestMicVolume':
|
|
280
|
+
this.handleOnTestMicVolume(uint32_1);
|
|
281
|
+
break;
|
|
282
|
+
case 'onTestSpeakerVolume':
|
|
283
|
+
this.handleOnTestSpeakerVolume(uint32_1);
|
|
284
|
+
break;
|
|
285
|
+
case 'onStartPublishing':
|
|
286
|
+
this.handleOnStartPublishing(int32_1, string_1);
|
|
287
|
+
break;
|
|
288
|
+
case 'onStopPublishing':
|
|
289
|
+
this.handleOnStopPublishing(int32_1, string_1);
|
|
290
|
+
break;
|
|
291
|
+
case 'onStartPublishCDNStream':
|
|
292
|
+
this.handleOnStartPublishCDNStream(int32_1, string_1);
|
|
293
|
+
break;
|
|
294
|
+
case 'onStopPublishCDNStream':
|
|
295
|
+
this.handleOnStopPublishCDNStream(int32_1, string_1);
|
|
296
|
+
break;
|
|
297
|
+
case 'onSetMixTranscodingConfig':
|
|
298
|
+
this.handleOnSetMixTranscodingConfig(int32_1, string_1);
|
|
299
|
+
break;
|
|
300
|
+
case 'onAudioEffectFinished':
|
|
301
|
+
this.handleOnAudioEffectFinished(int32_1, int32_2);
|
|
302
|
+
break;
|
|
303
|
+
case 'onScreenCaptureCovered':
|
|
304
|
+
this.handleOnScreenCaptureCovered();
|
|
305
|
+
break;
|
|
306
|
+
case 'onScreenCaptureStarted':
|
|
307
|
+
this.handleOnScreenCaptureStarted();
|
|
308
|
+
break;
|
|
309
|
+
case 'onScreenCapturePaused':
|
|
310
|
+
this.handleOnScreenCapturePaused(int32_1);
|
|
311
|
+
break;
|
|
312
|
+
case 'onScreenCaptureResumed':
|
|
313
|
+
this.handleOnScreenCaptureResumed(int32_1);
|
|
314
|
+
break;
|
|
315
|
+
case 'onScreenCaptureStoped':
|
|
316
|
+
this.handleOnScreenCaptureStopped(int32_1);
|
|
317
|
+
break;
|
|
318
|
+
case 'onSnapshotComplete':
|
|
319
|
+
this.handleOnSnapshotComplete(string_1, uint32_1, buff, int32_1, int32_2);
|
|
320
|
+
break;
|
|
321
|
+
case 'onPlayBGMBegin':
|
|
322
|
+
this.handleOnPlayBGMBegin(int32_1);
|
|
323
|
+
break;
|
|
324
|
+
case 'onPlayBGMProgress':
|
|
325
|
+
this.handleOnPlayBGMProgress(uint32_1, uint32_2);
|
|
326
|
+
break;
|
|
327
|
+
case 'onPlayBGMComplete':
|
|
328
|
+
this.handleOnPlayBGMComplete(int32_1);
|
|
329
|
+
break;
|
|
330
|
+
case 'onAudioDeviceCaptureVolumeChanged':
|
|
331
|
+
this.handleOnAudioDeviceCaptureVolumeChanged(uint32_1, uint32_2);
|
|
332
|
+
break;
|
|
333
|
+
case 'onAudioDevicePlayoutVolumeChanged':
|
|
334
|
+
this.handleOnAudioDevicePlayoutVolumeChanged(uint32_1, uint32_2);
|
|
335
|
+
break;
|
|
336
|
+
case 'onSystemAudioLoopbackError':
|
|
337
|
+
this.handleOnSystemAudioLoopbackError(int32_1);
|
|
338
|
+
break;
|
|
339
|
+
default:
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
219
343
|
this.bindOnNetworkQuality();
|
|
220
344
|
this.bindOnStatistics();
|
|
221
|
-
this.bindOnConnectionLost();
|
|
222
|
-
this.bindOnTryToReconnect();
|
|
223
|
-
this.bindOnConnectionRecovery();
|
|
224
345
|
this.bindOnSpeedTest();
|
|
225
|
-
this.bindOnSpeedTestResult();
|
|
226
|
-
this.bindOnCameraDidReady();
|
|
227
|
-
this.bindOnMicDidReady();
|
|
228
346
|
this.bindOnUserVoiceVolume();
|
|
229
|
-
this.bindOnDeviceChange();
|
|
230
|
-
this.bindOnTestMicVolume();
|
|
231
|
-
this.bindOnTestSpeakerVolume();
|
|
232
|
-
this.bindOnAudioDeviceCaptureVolumeChanged();
|
|
233
|
-
this.bindOnAudioDevicePlayoutVolumeChanged();
|
|
234
347
|
this.bindOnRecvCustomCmdMsg();
|
|
235
348
|
this.bindOnMissCustomCmdMsg();
|
|
236
349
|
this.bindOnRecvSEIMsg();
|
|
237
|
-
this.bindOnStartPublishing();
|
|
238
|
-
this.bindOnStopPublishing();
|
|
239
|
-
this.bindOnStartPublishCDNStream();
|
|
240
|
-
this.bindOnStopPublishCDNStream();
|
|
241
|
-
this.bindOnSetMixTranscodingConfig();
|
|
242
|
-
this.bindOnAudioEffectFinished();
|
|
243
|
-
this.bindOnScreenCaptureCovered();
|
|
244
|
-
this.bindOnScreenCaptureStarted();
|
|
245
|
-
this.bindOnScreenCapturePaused();
|
|
246
|
-
this.bindOnScreenCaptureResumed();
|
|
247
|
-
this.bindOnScreenCaptureStopped();
|
|
248
|
-
this.bindOnSnapshotComplete();
|
|
249
|
-
this.bindOnPlayBGMBegin();
|
|
250
|
-
this.bindOnPlayBGMProgress();
|
|
251
|
-
this.bindOnPlayBGMComplete();
|
|
252
|
-
this.bindOnMusicStart();
|
|
253
|
-
this.bindOnMusicPlayProgress();
|
|
254
|
-
this.bindOnMusicComplete();
|
|
255
|
-
this.bindOnSystemAudioLoopbackError();
|
|
256
350
|
}
|
|
257
351
|
fire(event, ...args) {
|
|
258
352
|
setImmediate(() => {
|
|
@@ -272,10 +366,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
272
366
|
* @param {Number} errCode - 错误码
|
|
273
367
|
* @param {String} errMsg - 错误信息
|
|
274
368
|
*/
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
this.fire('onError', errCode, errMsg);
|
|
278
|
-
});
|
|
369
|
+
handleOnError(errCode, errMsg) {
|
|
370
|
+
this.fire('onError', errCode, errMsg);
|
|
279
371
|
}
|
|
280
372
|
/**
|
|
281
373
|
* 1.2 警告回调:用于告知您一些非严重性问题,例如出现了卡顿或者可恢复的解码失败。
|
|
@@ -284,10 +376,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
284
376
|
* @param {Number} warningCode - 警告码
|
|
285
377
|
* @param {String} warningMsg - 警告信息
|
|
286
378
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
this.fire('onWarning', warningCode, warningMsg);
|
|
290
|
-
});
|
|
379
|
+
handleOnWarning(warningCode, warningMsg) {
|
|
380
|
+
this.fire('onWarning', warningCode, warningMsg);
|
|
291
381
|
}
|
|
292
382
|
/////////////////////////////////////////////////////////////////////////////////
|
|
293
383
|
//
|
|
@@ -309,17 +399,15 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
309
399
|
* @event TRTCCallback#onEnterRoom
|
|
310
400
|
* @param {Number} result - result > 0 时为进房耗时(ms),result < 0 时为进房错误码。
|
|
311
401
|
*/
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
rtcCloud.onlineLog(result, SDK_LOG_LEVEL, '[trtc-electron-sdk] trtcstats', formatLogParams(params));
|
|
322
|
-
});
|
|
402
|
+
handleOnEnterRoom(result) {
|
|
403
|
+
this.fire('onEnterRoom', result);
|
|
404
|
+
const params = {
|
|
405
|
+
js_version: pkg.version,
|
|
406
|
+
electron_version: process && process.versions && process.versions.electron || '',
|
|
407
|
+
arch: process && process.arch || '',
|
|
408
|
+
ua: window.navigator.userAgent
|
|
409
|
+
};
|
|
410
|
+
oriRtcCloud.onlineLog(result, SDK_LOG_LEVEL, '[trtc-electron-sdk] trtcstats', formatLogParams(params));
|
|
323
411
|
}
|
|
324
412
|
/**
|
|
325
413
|
* 2.2 退出房间的事件回调
|
|
@@ -333,12 +421,9 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
333
421
|
* @event TRTCCallback#onExitRoom
|
|
334
422
|
* @param {Number} reason - 离开房间原因,0:主动调用 exitRoom 退房;1:被服务器踢出当前房间;2:当前房间整个被解散。
|
|
335
423
|
*/
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
this.isLocalPreviewStarted = false;
|
|
340
|
-
this.fire('onExitRoom', reason);
|
|
341
|
-
});
|
|
424
|
+
handleOnExitRoom(reason) {
|
|
425
|
+
this.firstVideoFrameList = [];
|
|
426
|
+
this.fire('onExitRoom', reason);
|
|
342
427
|
}
|
|
343
428
|
/**
|
|
344
429
|
* 2.3 切换房间的事件回调
|
|
@@ -347,10 +432,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
347
432
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
348
433
|
* @param {String} errMsg - 错误信息。
|
|
349
434
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
this.fire('onSwitchRoom', errCode, errMsg);
|
|
353
|
-
});
|
|
435
|
+
handleOnSwitchRoom(errCode, errMsg) {
|
|
436
|
+
this.fire('onSwitchRoom', errCode, errMsg);
|
|
354
437
|
}
|
|
355
438
|
/**
|
|
356
439
|
* 2.4 切换角色的事件回调
|
|
@@ -362,10 +445,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
362
445
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
363
446
|
* @param {String} errMsg - 错误信息。
|
|
364
447
|
*/
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
this.fire('onSwitchRole', errCode, errMsg);
|
|
368
|
-
});
|
|
448
|
+
handleOnSwitchRole(errCode, errMsg) {
|
|
449
|
+
this.fire('onSwitchRole', errCode, errMsg);
|
|
369
450
|
}
|
|
370
451
|
/**
|
|
371
452
|
* 2.5 请求跨房连麦(主播跨房 PK)的结果回调
|
|
@@ -379,10 +460,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
379
460
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见[错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
380
461
|
* @param {String} errMsg - 错误信息。
|
|
381
462
|
*/
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
this.fire('onConnectOtherRoom', userId, errCode, errMsg);
|
|
385
|
-
});
|
|
463
|
+
handleOnConnectOtherRoom(userId, errCode, errMsg) {
|
|
464
|
+
this.fire('onConnectOtherRoom', userId, errCode, errMsg);
|
|
386
465
|
}
|
|
387
466
|
/**
|
|
388
467
|
* 2.6 关闭跨房连麦(主播跨房 PK)的结果回调
|
|
@@ -391,10 +470,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
391
470
|
* @param {Number} errCode - 错误码,ERR_NULL 代表切换成功,其他请参见 [错误码](https://cloud.tencent.com/document/product/647/32257)。
|
|
392
471
|
* @param {String} errMsg - 错误信息。
|
|
393
472
|
*/
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
this.fire('onDisconnectOtherRoom', errCode, errMsg);
|
|
397
|
-
});
|
|
473
|
+
handleOnDisconnectOtherRoom(errCode, errMsg) {
|
|
474
|
+
this.fire('onDisconnectOtherRoom', errCode, errMsg);
|
|
398
475
|
}
|
|
399
476
|
/////////////////////////////////////////////////////////////////////////////////
|
|
400
477
|
//
|
|
@@ -413,10 +490,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
413
490
|
* @event TRTCCallback#onRemoteUserEnterRoom
|
|
414
491
|
* @param {String} userId - 用户标识
|
|
415
492
|
*/
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
this.fire('onRemoteUserEnterRoom', userId);
|
|
419
|
-
});
|
|
493
|
+
handleOnRemoteUserEnterRoom(userId) {
|
|
494
|
+
this.fire('onRemoteUserEnterRoom', userId);
|
|
420
495
|
}
|
|
421
496
|
/**
|
|
422
497
|
* 3.2 有用户离开当前房间
|
|
@@ -429,19 +504,17 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
429
504
|
* @param {String} userId - 用户标识
|
|
430
505
|
* @param {Number} reason - 离开原因,0表示用户主动退出房间,1表示用户超时退出,2表示被踢出房间。
|
|
431
506
|
*/
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
this._destroyRender(key, null);
|
|
442
|
-
});
|
|
443
|
-
this.fire('onRemoteUserLeaveRoom', userId, reason);
|
|
507
|
+
handleOnRemoteUserLeaveRoom(userId, reason) {
|
|
508
|
+
const streamTypeList = [
|
|
509
|
+
trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig,
|
|
510
|
+
trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub,
|
|
511
|
+
trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSmall
|
|
512
|
+
];
|
|
513
|
+
streamTypeList.forEach(streamType => {
|
|
514
|
+
const key = this.getKey(userId, streamType);
|
|
515
|
+
this._destroyRender(key, null);
|
|
444
516
|
});
|
|
517
|
+
this.fire('onRemoteUserLeaveRoom', userId, reason);
|
|
445
518
|
}
|
|
446
519
|
/**
|
|
447
520
|
* 3.3 用户是否开启摄像头视频
|
|
@@ -457,17 +530,15 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
457
530
|
* @param {String} userId - 用户标识
|
|
458
531
|
* @param {Number} available - 画面是否开启
|
|
459
532
|
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
});
|
|
467
|
-
}
|
|
533
|
+
handleOnUserVideoAvailable(userId, available) {
|
|
534
|
+
if (this._isMacPlatform()) {
|
|
535
|
+
if (available == 0) {
|
|
536
|
+
this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
|
|
537
|
+
return !(userId === item.uid && item.type !== trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub);
|
|
538
|
+
});
|
|
468
539
|
}
|
|
469
|
-
|
|
470
|
-
|
|
540
|
+
}
|
|
541
|
+
this.fire('onUserVideoAvailable', userId, available);
|
|
471
542
|
}
|
|
472
543
|
/**
|
|
473
544
|
* 3.4 用户是否开启了辅路画面(TRTCVideoStreamTypeSub,一般用于屏幕分享)
|
|
@@ -478,17 +549,15 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
478
549
|
* @param {String} userId - 用户标识
|
|
479
550
|
* @param {Number} available - 辅路画面是否开启
|
|
480
551
|
*/
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
if (
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
});
|
|
488
|
-
}
|
|
552
|
+
handleOnUserSubStreamAvailable(userId, available) {
|
|
553
|
+
if (this._isMacPlatform()) {
|
|
554
|
+
if (available == 0) {
|
|
555
|
+
this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
|
|
556
|
+
return !(userId === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub);
|
|
557
|
+
});
|
|
489
558
|
}
|
|
490
|
-
|
|
491
|
-
|
|
559
|
+
}
|
|
560
|
+
this.fire('onUserSubStreamAvailable', userId, available);
|
|
492
561
|
}
|
|
493
562
|
/**
|
|
494
563
|
* 3.5 用户是否开启音频上行
|
|
@@ -497,10 +566,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
497
566
|
* @param {String} userId - 用户标识
|
|
498
567
|
* @param {Number} available - 声音是否开启
|
|
499
568
|
*/
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
this.fire('onUserAudioAvailable', userId, available);
|
|
503
|
-
});
|
|
569
|
+
handleOnUserAudioAvailable(userId, available) {
|
|
570
|
+
this.fire('onUserAudioAvailable', userId, available);
|
|
504
571
|
}
|
|
505
572
|
/**
|
|
506
573
|
* 3.6 开始渲染本地或远程用户的首帧画面
|
|
@@ -516,10 +583,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
516
583
|
* @param {Number} width - 画面宽度
|
|
517
584
|
* @param {Number} height - 画面高度
|
|
518
585
|
*/
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
this.fire('onFirstVideoFrame', userId, streamType, width, height);
|
|
522
|
-
});
|
|
586
|
+
handleOnFirstVideoFrame(userId, streamType, width, height) {
|
|
587
|
+
this.fire('onFirstVideoFrame', userId, streamType, width, height);
|
|
523
588
|
}
|
|
524
589
|
/**
|
|
525
590
|
* 3.7 开始播放远程用户的首帧音频(本地声音暂不通知)
|
|
@@ -527,10 +592,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
527
592
|
* @event TRTCCallback#onFirstAudioFrame
|
|
528
593
|
* @param {String} userId - 远程用户 ID。
|
|
529
594
|
*/
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
this.fire('onFirstAudioFrame', userId);
|
|
533
|
-
});
|
|
595
|
+
handleOnFirstAudioFrame(userId) {
|
|
596
|
+
this.fire('onFirstAudioFrame', userId);
|
|
534
597
|
}
|
|
535
598
|
/**
|
|
536
599
|
* 3.8 首帧本地视频数据已经被送出
|
|
@@ -541,10 +604,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
541
604
|
* @event TRTCCallback#onSendFirstLocalVideoFrame
|
|
542
605
|
* @param {Number} streamType - - 视频流类型,TRTCVideoStreamTypeBig:主路画面,一般用于摄像头;TRTCVideoStreamTypeSub:辅路画面,一般用于屏幕分享。
|
|
543
606
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
this.fire('onSendFirstLocalVideoFrame', streamType);
|
|
547
|
-
});
|
|
607
|
+
handleOnSendFirstLocalVideoFrame(streamType) {
|
|
608
|
+
this.fire('onSendFirstLocalVideoFrame', streamType);
|
|
548
609
|
}
|
|
549
610
|
/**
|
|
550
611
|
* 3.9 首帧本地音频数据已经被送出
|
|
@@ -554,10 +615,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
554
615
|
*
|
|
555
616
|
* @event TRTCCallback#onSendFirstLocalAudioFrame
|
|
556
617
|
*/
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
this.fire('onSendFirstLocalAudioFrame');
|
|
560
|
-
});
|
|
618
|
+
handleOnSendFirstLocalAudioFrame() {
|
|
619
|
+
this.fire('onSendFirstLocalAudioFrame');
|
|
561
620
|
}
|
|
562
621
|
/**
|
|
563
622
|
* 3.10 废弃事件:有主播加入当前房间
|
|
@@ -568,10 +627,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
568
627
|
* @event TRTCCallback#onUserEnter
|
|
569
628
|
* @param {String} userId - 用户标识
|
|
570
629
|
*/
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
this.fire('onUserEnter', userId);
|
|
574
|
-
});
|
|
630
|
+
handleOnUserEnter(userId) {
|
|
631
|
+
this.fire('onUserEnter', userId);
|
|
575
632
|
}
|
|
576
633
|
/**
|
|
577
634
|
* 3.11 废弃事件:有主播离开当前房间
|
|
@@ -583,10 +640,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
583
640
|
* @param {String} userId - 用户标识
|
|
584
641
|
* @param {Number} reason - 离开原因代码,区分用户是正常离开,还是由于网络断线等原因离开。
|
|
585
642
|
*/
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
this.fire('onUserExit', userId, reason);
|
|
589
|
-
});
|
|
643
|
+
handleOnUserExit(userId, reason) {
|
|
644
|
+
this.fire('onUserExit', userId, reason);
|
|
590
645
|
}
|
|
591
646
|
/////////////////////////////////////////////////////////////////////////////////
|
|
592
647
|
//
|
|
@@ -603,7 +658,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
603
658
|
* @param {TRTCQualityInfo[]} remoteQuality - 下行网络质量
|
|
604
659
|
*/
|
|
605
660
|
bindOnNetworkQuality() {
|
|
606
|
-
rtcCloud.onEvent('onNetworkQuality', (localQuality, remoteQuality) => {
|
|
661
|
+
this.rtcCloud.onEvent('onNetworkQuality', (localQuality, remoteQuality) => {
|
|
607
662
|
this.fire('onNetworkQuality', localQuality, remoteQuality);
|
|
608
663
|
});
|
|
609
664
|
}
|
|
@@ -619,7 +674,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
619
674
|
* @param {TRTCStatistics} statis - 统计数据,包括本地和远程的
|
|
620
675
|
*/
|
|
621
676
|
bindOnStatistics() {
|
|
622
|
-
rtcCloud.onEvent('onStatistics', (statis) => {
|
|
677
|
+
this.rtcCloud.onEvent('onStatistics', (statis) => {
|
|
623
678
|
this.fire('onStatistics', statis);
|
|
624
679
|
});
|
|
625
680
|
}
|
|
@@ -633,35 +688,27 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
633
688
|
*
|
|
634
689
|
* @event TRTCCallback#onConnectionLost
|
|
635
690
|
*/
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
this.fire('onConnectionLost');
|
|
639
|
-
});
|
|
691
|
+
handleOnConnectionLost() {
|
|
692
|
+
this.fire('onConnectionLost');
|
|
640
693
|
}
|
|
641
694
|
/**
|
|
642
695
|
* 5.2 SDK 尝试重新连接到服务器
|
|
643
696
|
*
|
|
644
697
|
* @event TRTCCallback#onTryToReconnect
|
|
645
698
|
*/
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
this.fire('onTryToReconnect');
|
|
649
|
-
});
|
|
699
|
+
handleOnTryToReconnect() {
|
|
700
|
+
this.fire('onTryToReconnect');
|
|
650
701
|
}
|
|
651
702
|
/**
|
|
652
703
|
* 5.3 SDK 跟服务器的连接恢复
|
|
653
704
|
*
|
|
654
705
|
* @event TRTCCallback#onConnectionRecovery
|
|
655
706
|
*/
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
this.fire('onConnectionRecovery');
|
|
659
|
-
});
|
|
707
|
+
handleOnConnectionRecovery() {
|
|
708
|
+
this.fire('onConnectionRecovery');
|
|
660
709
|
}
|
|
661
710
|
/**
|
|
662
|
-
* 5.4
|
|
663
|
-
*
|
|
664
|
-
* @deprecated 从 TRTCSDK 9.3 后该接口已被废弃,不会抛出该事件, 请采用 onSpeedTestResult 事件代替
|
|
711
|
+
* 5.4 服务器测速的回调,SDK 对多个服务器 IP 做测速,每个 IP 的测速结果通过这个回调通知
|
|
665
712
|
*
|
|
666
713
|
* @event TRTCCallback#onSpeedTest
|
|
667
714
|
* @param {TRTCSpeedTestResult} currentResult - 当前完成的测速结果
|
|
@@ -669,23 +716,10 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
669
716
|
* @param {Number} totalCount - 需要测速的服务器总数量
|
|
670
717
|
*/
|
|
671
718
|
bindOnSpeedTest() {
|
|
672
|
-
rtcCloud.onEvent('onSpeedTest', (currentResult, finishedCount, totalCount) => {
|
|
719
|
+
this.rtcCloud.onEvent('onSpeedTest', (currentResult, finishedCount, totalCount) => {
|
|
673
720
|
this.fire('onSpeedTest', currentResult, finishedCount, totalCount);
|
|
674
721
|
});
|
|
675
722
|
}
|
|
676
|
-
/**
|
|
677
|
-
* 5.5 网速测试的结果回调
|
|
678
|
-
*
|
|
679
|
-
* 该统计回调由 startSpeedTest 触发。
|
|
680
|
-
*
|
|
681
|
-
* @event TRTCCallback#onSpeedTestResult
|
|
682
|
-
* @param {TRTCSpeedTestResult} result 网速测试数据数据,包括丢包、往返延迟、上下行的带宽速率。
|
|
683
|
-
*/
|
|
684
|
-
bindOnSpeedTestResult() {
|
|
685
|
-
rtcCloud.onEvent('onSpeedTestResult', (result) => {
|
|
686
|
-
this.fire('onSpeedTestResult', result);
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
723
|
/////////////////////////////////////////////////////////////////////////////////
|
|
690
724
|
//
|
|
691
725
|
// (六)硬件设备事件回调
|
|
@@ -696,20 +730,16 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
696
730
|
*
|
|
697
731
|
* @event TRTCCallback#onCameraDidReady
|
|
698
732
|
*/
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
this.fire('onCameraDidReady');
|
|
702
|
-
});
|
|
733
|
+
handleOnCameraDidReady() {
|
|
734
|
+
this.fire('onCameraDidReady');
|
|
703
735
|
}
|
|
704
736
|
/**
|
|
705
737
|
* 6.2 麦克风准备就绪
|
|
706
738
|
*
|
|
707
739
|
* @event TRTCCallback#onMicDidReady
|
|
708
740
|
*/
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
this.fire('onMicDidReady');
|
|
712
|
-
});
|
|
741
|
+
handleOnMicDidReady() {
|
|
742
|
+
this.fire('onMicDidReady');
|
|
713
743
|
}
|
|
714
744
|
/**
|
|
715
745
|
* 6.3 userId 对应的成员语音音量
|
|
@@ -724,7 +754,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
724
754
|
* @param {Number} totalVolume - 总的语音音量, 取值范围0 - 100
|
|
725
755
|
*/
|
|
726
756
|
bindOnUserVoiceVolume() {
|
|
727
|
-
rtcCloud.onEvent('onUserVoiceVolume', (userVolumes, userVolumesCount, totalVolume) => {
|
|
757
|
+
this.rtcCloud.onEvent('onUserVoiceVolume', (userVolumes, userVolumesCount, totalVolume) => {
|
|
728
758
|
this.fire('onUserVoiceVolume', userVolumes, userVolumesCount, totalVolume);
|
|
729
759
|
});
|
|
730
760
|
}
|
|
@@ -736,10 +766,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
736
766
|
* @param {TRTCDeviceType} type - 设备类型
|
|
737
767
|
* @param {TRTCDeviceState} state - 事件类型
|
|
738
768
|
*/
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
this.fire('onDeviceChange', deviceId, type, state);
|
|
742
|
-
});
|
|
769
|
+
handleOnDeviceChange(deviceId, type, state) {
|
|
770
|
+
this.fire('onDeviceChange', deviceId, type, state);
|
|
743
771
|
}
|
|
744
772
|
/**
|
|
745
773
|
* 6.5 麦克风测试音量回调
|
|
@@ -749,10 +777,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
749
777
|
* @event TRTCCallback#onTestMicVolume
|
|
750
778
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
751
779
|
*/
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
this.fire('onTestMicVolume', volume);
|
|
755
|
-
});
|
|
780
|
+
handleOnTestMicVolume(volume) {
|
|
781
|
+
this.fire('onTestMicVolume', volume);
|
|
756
782
|
}
|
|
757
783
|
/**
|
|
758
784
|
* 6.6 扬声器测试音量回调
|
|
@@ -762,10 +788,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
762
788
|
* @event TRTCCallback#onTestSpeakerVolume
|
|
763
789
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
764
790
|
*/
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
this.fire('onTestSpeakerVolume', volume);
|
|
768
|
-
});
|
|
791
|
+
handleOnTestSpeakerVolume(volume) {
|
|
792
|
+
this.fire('onTestSpeakerVolume', volume);
|
|
769
793
|
}
|
|
770
794
|
/**
|
|
771
795
|
* 6.7 当前音频采集设备音量变化回调
|
|
@@ -776,10 +800,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
776
800
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
777
801
|
* @param {Boolean} muted - 当前采集音频设备是否被静音
|
|
778
802
|
*/
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
this.fire('onAudioDeviceCaptureVolumeChanged', volume, muted);
|
|
782
|
-
});
|
|
803
|
+
handleOnAudioDeviceCaptureVolumeChanged(volume, muted) {
|
|
804
|
+
this.fire('onAudioDeviceCaptureVolumeChanged', volume, muted);
|
|
783
805
|
}
|
|
784
806
|
/**
|
|
785
807
|
* 6.8 当前音频播放设备音量变化回调
|
|
@@ -790,10 +812,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
790
812
|
* @param {Number} volume - 音量值,取值范围0 - 100
|
|
791
813
|
* @param {Boolean} muted - 当前音频播放设备是否被静音
|
|
792
814
|
*/
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
this.fire('onAudioDevicePlayoutVolumeChanged', volume, muted);
|
|
796
|
-
});
|
|
815
|
+
handleOnAudioDevicePlayoutVolumeChanged(volume, muted) {
|
|
816
|
+
this.fire('onAudioDevicePlayoutVolumeChanged', volume, muted);
|
|
797
817
|
}
|
|
798
818
|
/////////////////////////////////////////////////////////////////////////////////
|
|
799
819
|
//
|
|
@@ -813,7 +833,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
813
833
|
* @param {String} msg - 消息数据
|
|
814
834
|
*/
|
|
815
835
|
bindOnRecvCustomCmdMsg() {
|
|
816
|
-
rtcCloud.onEvent('onRecvCustomCmdMsg', (userId, cmdId, seq, msg) => {
|
|
836
|
+
this.rtcCloud.onEvent('onRecvCustomCmdMsg', (userId, cmdId, seq, msg) => {
|
|
817
837
|
this.fire('onRecvCustomCmdMsg', userId, cmdId, seq, msg);
|
|
818
838
|
});
|
|
819
839
|
}
|
|
@@ -832,7 +852,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
832
852
|
* @param {Number} missed - 丢失的消息数量
|
|
833
853
|
*/
|
|
834
854
|
bindOnMissCustomCmdMsg() {
|
|
835
|
-
rtcCloud.onEvent('onMissCustomCmdMsg', (userId, cmdId, errCode, missed) => {
|
|
855
|
+
this.rtcCloud.onEvent('onMissCustomCmdMsg', (userId, cmdId, errCode, missed) => {
|
|
836
856
|
this.fire('onMissCustomCmdMsg', userId, cmdId, errCode, missed);
|
|
837
857
|
});
|
|
838
858
|
}
|
|
@@ -846,7 +866,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
846
866
|
* @param {String} message - 数据
|
|
847
867
|
*/
|
|
848
868
|
bindOnRecvSEIMsg() {
|
|
849
|
-
rtcCloud.onEvent('onRecvSEIMsg', (userId, message) => {
|
|
869
|
+
this.rtcCloud.onEvent('onRecvSEIMsg', (userId, message) => {
|
|
850
870
|
this.fire('onRecvSEIMsg', userId, message);
|
|
851
871
|
});
|
|
852
872
|
}
|
|
@@ -862,10 +882,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
862
882
|
* @param {Number} errCode - 0表示成功,其余值表示失败
|
|
863
883
|
* @param {String} errMsg - 具体错误原因
|
|
864
884
|
*/
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
this.fire('onStartPublishing', errCode, errMsg);
|
|
868
|
-
});
|
|
885
|
+
handleOnStartPublishing(errCode, errMsg) {
|
|
886
|
+
this.fire('onStartPublishing', errCode, errMsg);
|
|
869
887
|
}
|
|
870
888
|
/**
|
|
871
889
|
* 8.2 停止向腾讯云的直播 CDN 推流的回调,对应于 TRTCCloud 中的 [stopPublishing()]{@link TRTCCloud#stopPublishing} 接口
|
|
@@ -874,10 +892,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
874
892
|
* @param {Number} errCode - 0表示成功,其余值表示失败
|
|
875
893
|
* @param {String} errMsg - 具体错误原因
|
|
876
894
|
*/
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
this.fire('onStopPublishing', errCode, errMsg);
|
|
880
|
-
});
|
|
895
|
+
handleOnStopPublishing(errCode, errMsg) {
|
|
896
|
+
this.fire('onStopPublishing');
|
|
881
897
|
}
|
|
882
898
|
/**
|
|
883
899
|
* 8.3 旁路推流到 CDN 的回调
|
|
@@ -890,10 +906,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
890
906
|
* @param {Number} errCode - 错误码
|
|
891
907
|
* @param {String} errMsg - 错误详细信息
|
|
892
908
|
*/
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
this.fire('onStartPublishCDNStream', errCode, errMsg);
|
|
896
|
-
});
|
|
909
|
+
handleOnStartPublishCDNStream(errCode, errMsg) {
|
|
910
|
+
this.fire('onStartPublishCDNStream', errCode, errMsg);
|
|
897
911
|
}
|
|
898
912
|
/**
|
|
899
913
|
* 8.4 停止旁路推流到 CDN 的回调
|
|
@@ -904,10 +918,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
904
918
|
* @param {Number} errCode - 错误码
|
|
905
919
|
* @param {String} errMsg - 错误详细信息
|
|
906
920
|
*/
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
this.fire('onStopPublishCDNStream', errCode, errMsg);
|
|
910
|
-
});
|
|
921
|
+
handleOnStopPublishCDNStream(errCode, errMsg) {
|
|
922
|
+
this.fire('onStopPublishCDNStream', errCode, errMsg);
|
|
911
923
|
}
|
|
912
924
|
/**
|
|
913
925
|
* 8.5 设置云端的混流转码参数的回调
|
|
@@ -918,10 +930,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
918
930
|
* @param {Number} errCode - 错误码
|
|
919
931
|
* @param {String} errMsg - 错误详细信息
|
|
920
932
|
*/
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
this.fire('onSetMixTranscodingConfig', errCode, errMsg);
|
|
924
|
-
});
|
|
933
|
+
handleOnSetMixTranscodingConfig(errCode, errMsg) {
|
|
934
|
+
this.fire('onSetMixTranscodingConfig', errCode, errMsg);
|
|
925
935
|
}
|
|
926
936
|
/////////////////////////////////////////////////////////////////////////////////
|
|
927
937
|
//
|
|
@@ -937,10 +947,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
937
947
|
* @param {Number} effectId - 音效 ID
|
|
938
948
|
* @param {Number} code - 0表示播放正常结束;其他表示异常结束
|
|
939
949
|
*/
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
this.fire('onAudioEffectFinished', effectId, code);
|
|
943
|
-
});
|
|
950
|
+
handleOnAudioEffectFinished(effectId, code) {
|
|
951
|
+
this.fire('onAudioEffectFinished', effectId, code);
|
|
944
952
|
}
|
|
945
953
|
/////////////////////////////////////////////////////////////////////////////////
|
|
946
954
|
//
|
|
@@ -952,20 +960,16 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
952
960
|
*
|
|
953
961
|
* @event TRTCCallback#onScreenCaptureCovered
|
|
954
962
|
*/
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
this.fire('onScreenCaptureCovered');
|
|
958
|
-
});
|
|
963
|
+
handleOnScreenCaptureCovered() {
|
|
964
|
+
this.fire('onScreenCaptureCovered');
|
|
959
965
|
}
|
|
960
966
|
/**
|
|
961
967
|
* 10.2 当屏幕分享开始时,SDK 会通过此回调通知
|
|
962
968
|
*
|
|
963
969
|
* @event TRTCCallback#onScreenCaptureStarted
|
|
964
970
|
*/
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
this.fire('onScreenCaptureStarted');
|
|
968
|
-
});
|
|
971
|
+
handleOnScreenCaptureStarted() {
|
|
972
|
+
this.fire('onScreenCaptureStarted');
|
|
969
973
|
}
|
|
970
974
|
/**
|
|
971
975
|
* 10.3 当屏幕分享暂停时,SDK 会通过此回调通知
|
|
@@ -973,10 +977,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
973
977
|
* @event TRTCCallback#onScreenCapturePaused
|
|
974
978
|
* @param {Number} reason - 停止原因,0:表示用户主动暂停;1:表示设置屏幕分享参数导致的暂停;2:表示屏幕分享窗口被最小化导致的暂停;3:表示屏幕分享窗口被隐藏导致的暂停
|
|
975
979
|
*/
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
this.fire('onScreenCapturePaused', reason);
|
|
979
|
-
});
|
|
980
|
+
handleOnScreenCapturePaused(reason) {
|
|
981
|
+
this.fire('onScreenCapturePaused', reason);
|
|
980
982
|
}
|
|
981
983
|
/**
|
|
982
984
|
* 10.4 当屏幕分享恢复时,SDK 会通过此回调通知
|
|
@@ -984,10 +986,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
984
986
|
* @event TRTCCallback#onScreenCaptureResumed
|
|
985
987
|
* @param {Number} reason - 停止原因,0:表示用户主动恢复,1:表示屏幕分享参数设置完毕后自动恢复;2:表示屏幕分享窗口从最小化被恢复;3:表示屏幕分享窗口从隐藏被恢复
|
|
986
988
|
*/
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
this.fire('onScreenCaptureResumed', reason);
|
|
990
|
-
});
|
|
989
|
+
handleOnScreenCaptureResumed(reason) {
|
|
990
|
+
this.fire('onScreenCaptureResumed', reason);
|
|
991
991
|
}
|
|
992
992
|
/**
|
|
993
993
|
* 10.5 当屏幕分享停止时,SDK 会通过此回调通知
|
|
@@ -995,12 +995,10 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
995
995
|
* @event TRTCCallback#onScreenCaptureStopped
|
|
996
996
|
* @param {Number} reason - 停止原因,0:表示用户主动停止;1:表示屏幕分享窗口被关闭
|
|
997
997
|
*/
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
this.fire('onScreenCaptureStopped', reason);
|
|
1003
|
-
});
|
|
998
|
+
handleOnScreenCaptureStopped(reason) {
|
|
999
|
+
this.fire('onScreenCaptureStoped', reason);
|
|
1000
|
+
// 兼容旧版的单词拼写错误,避免旧版用户升级后无法触发回调
|
|
1001
|
+
this.fire('onScreenCaptureStopped', reason);
|
|
1004
1002
|
}
|
|
1005
1003
|
/////////////////////////////////////////////////////////////////////////////////
|
|
1006
1004
|
//
|
|
@@ -1018,18 +1016,16 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1018
1016
|
* @param {Number} width - 截图画面的宽度
|
|
1019
1017
|
* @param {Number} height - 截图画面的高度
|
|
1020
1018
|
*/
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
this.fire('onSnapshotComplete', userId, type, data, width, height);
|
|
1032
|
-
});
|
|
1019
|
+
handleOnSnapshotComplete(userId, type, buffer, width, height) {
|
|
1020
|
+
const rgbData = this._BGRA2RGBA(buffer, width, height);
|
|
1021
|
+
const canvas = document.createElement('canvas');
|
|
1022
|
+
canvas.width = width;
|
|
1023
|
+
canvas.height = height;
|
|
1024
|
+
const ctx = canvas.getContext('2d');
|
|
1025
|
+
const tmpImage = new ImageData(rgbData, width, height);
|
|
1026
|
+
ctx && ctx.putImageData(tmpImage, 0, 0);
|
|
1027
|
+
const data = canvas.toDataURL();
|
|
1028
|
+
this.fire('onSnapshotComplete', userId, type, data, width, height);
|
|
1033
1029
|
}
|
|
1034
1030
|
/////////////////////////////////////////////////////////////////////////////////
|
|
1035
1031
|
//
|
|
@@ -1044,13 +1040,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1044
1040
|
* @event TRTCCallback#onPlayBGMBegin
|
|
1045
1041
|
* @param {Number} errCode - 错误码
|
|
1046
1042
|
*/
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
bindOnMusicStart() {
|
|
1050
|
-
rtcCloud.onEvent('onStart', (id, errCode) => {
|
|
1051
|
-
this.fire('onPlayBGMBegin', errCode);
|
|
1052
|
-
onMusicStartCb && onMusicStartCb(id, errCode);
|
|
1053
|
-
});
|
|
1043
|
+
handleOnPlayBGMBegin(errCode) {
|
|
1044
|
+
this.fire('onPlayBGMBegin', errCode);
|
|
1054
1045
|
}
|
|
1055
1046
|
/**
|
|
1056
1047
|
* 12.2 废弃事件: 播放背景音乐的进度
|
|
@@ -1061,13 +1052,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1061
1052
|
* @param {Number} progressMS - 已播放时间
|
|
1062
1053
|
* @param {Number} durationMS - 总时间
|
|
1063
1054
|
*/
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
bindOnMusicPlayProgress() {
|
|
1067
|
-
rtcCloud.onEvent('onPlayProgress', (id, progressMS, durationMS) => {
|
|
1068
|
-
this.fire('onPlayBGMProgress', progressMS, durationMS);
|
|
1069
|
-
onMusicPlayProgressCb && onMusicPlayProgressCb(id, progressMS, durationMS);
|
|
1070
|
-
});
|
|
1055
|
+
handleOnPlayBGMProgress(progressMS, durationMS) {
|
|
1056
|
+
this.fire('onPlayBGMProgress', progressMS, durationMS);
|
|
1071
1057
|
}
|
|
1072
1058
|
/**
|
|
1073
1059
|
* 12.3 废弃事件: 播放背景音乐结束
|
|
@@ -1077,13 +1063,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1077
1063
|
* @event TRTCCallback#onPlayBGMComplete
|
|
1078
1064
|
* @param {Number} errCode - 错误码
|
|
1079
1065
|
*/
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
bindOnMusicComplete() {
|
|
1083
|
-
rtcCloud.onEvent('onComplete', (id, errCode) => {
|
|
1084
|
-
this.fire('onPlayBGMComplete', errCode);
|
|
1085
|
-
onMusicPlayCompleteCb && onMusicPlayCompleteCb(id, errCode);
|
|
1086
|
-
});
|
|
1066
|
+
handleOnPlayBGMComplete(errCode) {
|
|
1067
|
+
this.fire('onPlayBGMComplete', errCode);
|
|
1087
1068
|
}
|
|
1088
1069
|
/////////////////////////////////////////////////////////////////////////////////
|
|
1089
1070
|
//
|
|
@@ -1101,10 +1082,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1101
1082
|
* - ERR_AUDIO_PLUGIN_INSTALL_NOT_AUTHORIZED (-1331) :未授权安装音频驱动插件
|
|
1102
1083
|
* - ERR_AUDIO_PLUGIN_INSTALL_FAILED (-1332) :安装音频驱动插件失败
|
|
1103
1084
|
*/
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
this.fire('onSystemAudioLoopbackError', errCode);
|
|
1107
|
-
});
|
|
1085
|
+
handleOnSystemAudioLoopbackError(errCode) {
|
|
1086
|
+
this.fire('onSystemAudioLoopbackError', errCode);
|
|
1108
1087
|
}
|
|
1109
1088
|
/////////////////////////////////////////////////////////////////////////////////
|
|
1110
1089
|
//
|
|
@@ -1155,7 +1134,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1155
1134
|
*/
|
|
1156
1135
|
enterRoom(params, scene) {
|
|
1157
1136
|
if (params instanceof trtc_define_1.TRTCParams) {
|
|
1158
|
-
rtcCloud.enterRoom(params, scene);
|
|
1137
|
+
this.rtcCloud.enterRoom(params.sdkAppId, params.roomId, params.strRoomId, params.userId, params.userSig, params.privateMapKey, params.businessInfo, params.role, params.userDefineRecordId, params.streamId === '' ? null : params.streamId, scene);
|
|
1159
1138
|
}
|
|
1160
1139
|
else {
|
|
1161
1140
|
console.error('enterRoom, params is not instanceof TRTCParams!');
|
|
@@ -1174,7 +1153,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1174
1153
|
this.streams.forEach((value, key, map) => {
|
|
1175
1154
|
this._destroyRender(key, null);
|
|
1176
1155
|
});
|
|
1177
|
-
rtcCloud.exitRoom();
|
|
1156
|
+
this.rtcCloud.exitRoom();
|
|
1178
1157
|
}
|
|
1179
1158
|
/**
|
|
1180
1159
|
* 1.3 切换房间
|
|
@@ -1188,7 +1167,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1188
1167
|
* 接口调用结果会通过 TRTCCloudListener 中的 onSwitchRoom(errCode, errMsg) 回调通知给您。
|
|
1189
1168
|
*/
|
|
1190
1169
|
switchRoom(params) {
|
|
1191
|
-
rtcCloud.switchRoom(params);
|
|
1170
|
+
this.rtcCloud.switchRoom(params.roomId, params.strRoomId, params.userSig, params.privateMapKey);
|
|
1192
1171
|
}
|
|
1193
1172
|
/**
|
|
1194
1173
|
* 1.4 切换角色,仅适用于直播场景(TRTCAppSceneLIVE 和 TRTCAppSceneVoiceChatRoom)
|
|
@@ -1201,7 +1180,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1201
1180
|
* - TRTCRoleAudience: 观众,只能观看,不能上行视频和音频,一个房间里的观众人数没有上限。
|
|
1202
1181
|
*/
|
|
1203
1182
|
switchRole(role) {
|
|
1204
|
-
rtcCloud.switchRole(role);
|
|
1183
|
+
this.rtcCloud.switchRole(role);
|
|
1205
1184
|
}
|
|
1206
1185
|
/**
|
|
1207
1186
|
* 1.5 请求跨房连麦(主播跨房 PK)
|
|
@@ -1243,7 +1222,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1243
1222
|
*
|
|
1244
1223
|
*/
|
|
1245
1224
|
connectOtherRoom(params) {
|
|
1246
|
-
rtcCloud.connectOtherRoom(params);
|
|
1225
|
+
this.rtcCloud.connectOtherRoom(params);
|
|
1247
1226
|
}
|
|
1248
1227
|
/**
|
|
1249
1228
|
* 1.6 关闭跨房连麦(主播跨房 PK)
|
|
@@ -1251,7 +1230,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1251
1230
|
* 跨房连麦的退出结果会通过 TRTCCallback 中的 onDisconnectOtherRoom 回调通知给您。
|
|
1252
1231
|
*/
|
|
1253
1232
|
disconnectOtherRoom() {
|
|
1254
|
-
rtcCloud.disconnectOtherRoom();
|
|
1233
|
+
this.rtcCloud.disconnectOtherRoom();
|
|
1255
1234
|
}
|
|
1256
1235
|
/**
|
|
1257
1236
|
* 1.7 设置音视频数据接收模式(需要在进房前设置才能生效)
|
|
@@ -1267,7 +1246,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1267
1246
|
*
|
|
1268
1247
|
*/
|
|
1269
1248
|
setDefaultStreamRecvMode(autoRecvAudio, autoRecvVideo) {
|
|
1270
|
-
rtcCloud.setDefaultStreamRecvMode(autoRecvAudio, autoRecvVideo);
|
|
1249
|
+
this.rtcCloud.setDefaultStreamRecvMode(autoRecvAudio, autoRecvVideo);
|
|
1271
1250
|
}
|
|
1272
1251
|
/////////////////////////////////////////////////////////////////////////////////
|
|
1273
1252
|
//
|
|
@@ -1299,13 +1278,13 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1299
1278
|
* @param {TRTCVideoStreamType} type - 仅支持 TRTCVideoStreamTypeBig 和 TRTCVideoStreamTypeSub。
|
|
1300
1279
|
*/
|
|
1301
1280
|
startPublishing(streamId, type) {
|
|
1302
|
-
rtcCloud.startPublishing(streamId, type);
|
|
1281
|
+
this.rtcCloud.startPublishing(streamId, type);
|
|
1303
1282
|
}
|
|
1304
1283
|
/**
|
|
1305
1284
|
* 2.2 停止向腾讯云的直播 CDN 推流
|
|
1306
1285
|
*/
|
|
1307
1286
|
stopPublishing() {
|
|
1308
|
-
rtcCloud.stopPublishing();
|
|
1287
|
+
this.rtcCloud.stopPublishing();
|
|
1309
1288
|
}
|
|
1310
1289
|
/**
|
|
1311
1290
|
* 2.3 开始向非腾讯云的直播 CDN 转推
|
|
@@ -1321,7 +1300,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1321
1300
|
*/
|
|
1322
1301
|
startPublishCDNStream(param) {
|
|
1323
1302
|
if (param instanceof trtc_define_1.TRTCPublishCDNParam) {
|
|
1324
|
-
rtcCloud.startPublishCDNStream(param);
|
|
1303
|
+
this.rtcCloud.startPublishCDNStream(param.appId, param.bizId, param.url);
|
|
1325
1304
|
}
|
|
1326
1305
|
else {
|
|
1327
1306
|
console.error('startPublishCDNStream, param is not instanceof TRTCPublishCDNParam!');
|
|
@@ -1331,7 +1310,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1331
1310
|
* 2.4 停止向非腾讯云的直播 CDN 推流
|
|
1332
1311
|
*/
|
|
1333
1312
|
stopPublishCDNStream() {
|
|
1334
|
-
rtcCloud.stopPublishCDNStream();
|
|
1313
|
+
this.rtcCloud.stopPublishCDNStream();
|
|
1335
1314
|
}
|
|
1336
1315
|
/**
|
|
1337
1316
|
* 2.5 设置云端的混流转码参数
|
|
@@ -1361,8 +1340,6 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1361
1340
|
*
|
|
1362
1341
|
* 参考文档:[云端混流转码](https://cloud.tencent.com/document/product/647/16827)。
|
|
1363
1342
|
*
|
|
1364
|
-
* 注意:混流转码为收费功能,调用接口将产生云端混流转码费用,详见 [云端混流转码计费说明](https://cloud.tencent.com/document/product/647/49446)。
|
|
1365
|
-
*
|
|
1366
1343
|
* @note 关于云端混流的注意事项:
|
|
1367
1344
|
* - 云端转码会引入一定的 CDN 观看延时,大概会增加1 - 2秒。
|
|
1368
1345
|
* - 调用该函数的用户,会将连麦中的多路画面混合到自己当前这路画面中。
|
|
@@ -1396,7 +1373,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1396
1373
|
*/
|
|
1397
1374
|
setMixTranscodingConfig(config) {
|
|
1398
1375
|
if (config === null) {
|
|
1399
|
-
rtcCloud.
|
|
1376
|
+
this.rtcCloud.setMixTranscodingConfig(-1);
|
|
1400
1377
|
return;
|
|
1401
1378
|
}
|
|
1402
1379
|
// configModeMap 为了兼容 TRTC_ 下划线用法
|
|
@@ -1424,10 +1401,9 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1424
1401
|
case trtc_define_1.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Template_PureAudio:
|
|
1425
1402
|
case trtc_define_1.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Template_ScreenSharing:
|
|
1426
1403
|
config.mixUsersArray = [];
|
|
1427
|
-
config.mixUsersArraySize = config.mixUsersArray.length;
|
|
1428
1404
|
break;
|
|
1429
1405
|
}
|
|
1430
|
-
rtcCloud.setMixTranscodingConfig(config);
|
|
1406
|
+
this.rtcCloud.setMixTranscodingConfig(configMode, config.appId, config.bizId, config.videoWidth, config.videoHeight, config.videoBitrate, config.videoFramerate, config.videoGOP, config.audioSampleRate, config.audioBitrate, config.audioChannels, config.backgroundColor, config.backgroundImage, config.streamId, config.mixUsersArray);
|
|
1431
1407
|
}
|
|
1432
1408
|
else {
|
|
1433
1409
|
console.error('setMixTranscodingConfig, config is not instanceof TRTCTranscodingConfig!');
|
|
@@ -1452,8 +1428,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1452
1428
|
let key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
|
|
1453
1429
|
this._initRender(key, view);
|
|
1454
1430
|
}
|
|
1455
|
-
this.
|
|
1456
|
-
rtcCloud.startLocalPreview(EMPTY_VIEW);
|
|
1431
|
+
this.rtcCloud.startLocalPreview();
|
|
1457
1432
|
this.addLocalVideoRenderCallback();
|
|
1458
1433
|
}
|
|
1459
1434
|
else {
|
|
@@ -1466,31 +1441,19 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1466
1441
|
stopLocalPreview() {
|
|
1467
1442
|
let key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
|
|
1468
1443
|
this._destroyRender(key, null);
|
|
1469
|
-
rtcCloud.stopLocalPreview();
|
|
1470
|
-
this.
|
|
1471
|
-
|
|
1472
|
-
return !(this._isLocalUser(item.uid) && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
|
|
1444
|
+
this.rtcCloud.stopLocalPreview();
|
|
1445
|
+
this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
|
|
1446
|
+
return !('' === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
|
|
1473
1447
|
});
|
|
1474
1448
|
}
|
|
1475
1449
|
/**
|
|
1476
|
-
* 3.3
|
|
1450
|
+
* 3.3 是否屏蔽自己的视频画面
|
|
1477
1451
|
*
|
|
1478
|
-
*
|
|
1479
|
-
*
|
|
1480
|
-
* 因为 start/stopLocalPreview 需要打开和关闭摄像头,而打开和关闭摄像头都是硬件设备相关的操作,非常耗时。
|
|
1481
|
-
* 相比之下,muteLocalVideo 只需要在软件层面对数据流进行暂停或者放行即可,因此效率更高,也更适合需要频繁打开关闭的场景。
|
|
1482
|
-
* 当暂停/恢复发布指定 TRTCVideoStreamTypeBig 后,同一房间中的其他用户将会收到 onUserVideoAvailable 回调通知。
|
|
1483
|
-
* 当暂停/恢复发布指定 TRTCVideoStreamTypeSub 后,同一房间中的其他用户将会收到 onUserSubStreamAvailable 回调通知。
|
|
1484
|
-
*
|
|
1485
|
-
* @param {Boolean} mute - true:屏蔽;false:开启,默认值:false
|
|
1486
|
-
* @param {TRTCVideoStreamType} streamType - 要暂停/恢复的视频流类型, 仅支持 TRTCVideoStreamTypeBig 和 TRTCVideoStreamTypeSub
|
|
1452
|
+
* 当屏蔽本地视频后,房间里的其它成员将会收到 onUserVideoAvailable 回调通知
|
|
1453
|
+
* @param {Boolean} mute - true:屏蔽;false:开启,默认值:false
|
|
1487
1454
|
*/
|
|
1488
|
-
muteLocalVideo(mute
|
|
1489
|
-
|
|
1490
|
-
if (newStreamType === undefined) {
|
|
1491
|
-
newStreamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
1492
|
-
}
|
|
1493
|
-
rtcCloud.muteLocalVideo(newStreamType, mute);
|
|
1455
|
+
muteLocalVideo(mute) {
|
|
1456
|
+
this.rtcCloud.muteLocalVideo(mute);
|
|
1494
1457
|
}
|
|
1495
1458
|
/**
|
|
1496
1459
|
* 3.4 开始显示远端视频画面
|
|
@@ -1519,7 +1482,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1519
1482
|
this._initRender(key, view);
|
|
1520
1483
|
}
|
|
1521
1484
|
this.addRemoteVideoRenderCallback(userId);
|
|
1522
|
-
rtcCloud.startRemoteView(userId, streamType
|
|
1485
|
+
this.rtcCloud.startRemoteView(userId, streamType);
|
|
1523
1486
|
}
|
|
1524
1487
|
else {
|
|
1525
1488
|
console.error('startRemoteView, view is undefined!');
|
|
@@ -1539,7 +1502,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1539
1502
|
}
|
|
1540
1503
|
let key = this.getKey(userId, streamType);
|
|
1541
1504
|
this._destroyRender(key, null);
|
|
1542
|
-
rtcCloud.stopRemoteView(userId, streamType);
|
|
1505
|
+
this.rtcCloud.stopRemoteView(userId, streamType);
|
|
1543
1506
|
}
|
|
1544
1507
|
/**
|
|
1545
1508
|
* 3.6 停止显示所有远端视频画面,同时不再拉取该远端用户的视频数据流
|
|
@@ -1553,7 +1516,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1553
1516
|
this._destroyRender(key, null);
|
|
1554
1517
|
}
|
|
1555
1518
|
});
|
|
1556
|
-
rtcCloud.stopAllRemoteView();
|
|
1519
|
+
this.rtcCloud.stopAllRemoteView();
|
|
1557
1520
|
}
|
|
1558
1521
|
/**
|
|
1559
1522
|
* 3.7 暂停接收指定的远端视频流
|
|
@@ -1562,14 +1525,9 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1562
1525
|
*
|
|
1563
1526
|
* @param {String} userId - 对方的用户标识
|
|
1564
1527
|
* @param {Boolean} mute - 是否停止接收
|
|
1565
|
-
* @param {TRTCVideoStreamType} streamType - 视频流类型
|
|
1566
1528
|
*/
|
|
1567
|
-
muteRemoteVideoStream(userId, mute
|
|
1568
|
-
|
|
1569
|
-
if (newStreamType === undefined) {
|
|
1570
|
-
newStreamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
|
|
1571
|
-
}
|
|
1572
|
-
rtcCloud.muteRemoteVideoStream(userId, newStreamType, mute);
|
|
1529
|
+
muteRemoteVideoStream(userId, mute) {
|
|
1530
|
+
this.rtcCloud.muteRemoteVideoStream(userId, mute);
|
|
1573
1531
|
}
|
|
1574
1532
|
/**
|
|
1575
1533
|
* 3.8 停止接收所有远端视频流
|
|
@@ -1577,7 +1535,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1577
1535
|
* @param {Boolean} mute - 是否停止接收
|
|
1578
1536
|
*/
|
|
1579
1537
|
muteAllRemoteVideoStreams(mute) {
|
|
1580
|
-
rtcCloud.muteAllRemoteVideoStreams(mute);
|
|
1538
|
+
this.rtcCloud.muteAllRemoteVideoStreams(mute);
|
|
1581
1539
|
}
|
|
1582
1540
|
/**
|
|
1583
1541
|
* 3.9 设置视频编码器相关参数
|
|
@@ -1595,7 +1553,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1595
1553
|
*/
|
|
1596
1554
|
setVideoEncoderParam(params) {
|
|
1597
1555
|
if (params instanceof trtc_define_1.TRTCVideoEncParam) {
|
|
1598
|
-
rtcCloud.setVideoEncoderParam(params);
|
|
1556
|
+
this.rtcCloud.setVideoEncoderParam(params.videoResolution, params.resMode, params.videoFps, params.videoBitrate, params.minVideoBitrate, params.enableAdjustRes);
|
|
1599
1557
|
}
|
|
1600
1558
|
else {
|
|
1601
1559
|
console.error('setVideoEncoderParam, params is not instanceof TRTCVideoEncParam!');
|
|
@@ -1616,7 +1574,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1616
1574
|
*/
|
|
1617
1575
|
setNetworkQosParam(params) {
|
|
1618
1576
|
if (params instanceof trtc_define_1.TRTCNetworkQosParam) {
|
|
1619
|
-
rtcCloud.setNetworkQosParam(params);
|
|
1577
|
+
this.rtcCloud.setNetworkQosParam(params.preference, params.controlMode);
|
|
1620
1578
|
}
|
|
1621
1579
|
else {
|
|
1622
1580
|
console.error('setNetworkQosParam, params is not instanceof TRTCNetworkQosParam!');
|
|
@@ -1635,7 +1593,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1635
1593
|
this.localRotation = params.rotation;
|
|
1636
1594
|
this.localMirrorType = params.mirrorType;
|
|
1637
1595
|
this.setLocalViewFillMode(params.fillMode);
|
|
1638
|
-
rtcCloud.setLocalRenderParams(params);
|
|
1596
|
+
this.rtcCloud.setLocalRenderParams(params.rotation, params.fillMode, params.mirrorType);
|
|
1639
1597
|
}
|
|
1640
1598
|
/**
|
|
1641
1599
|
* 3.12 废弃接口: 设置本地图像的渲染模式
|
|
@@ -1679,7 +1637,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1679
1637
|
this.remoteSubStreamMirrorType = params.mirrorType;
|
|
1680
1638
|
this.setRemoteSubStreamViewFillMode(userId, params.fillMode);
|
|
1681
1639
|
}
|
|
1682
|
-
rtcCloud.setRemoteRenderParams(userId, streamType, params);
|
|
1640
|
+
this.rtcCloud.setRemoteRenderParams(userId, streamType, params.rotation, params.fillMode, params.mirrorType);
|
|
1683
1641
|
}
|
|
1684
1642
|
/**
|
|
1685
1643
|
* 3.14 废弃接口: 设置远端图像的渲染模式
|
|
@@ -1747,7 +1705,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1747
1705
|
* - TRTCVideoRotation180: 顺时针旋转180度
|
|
1748
1706
|
*/
|
|
1749
1707
|
setVideoEncoderRotation(rotation) {
|
|
1750
|
-
rtcCloud.setVideoEncoderRotation(rotation);
|
|
1708
|
+
this.rtcCloud.setVideoEncoderRotation(rotation);
|
|
1751
1709
|
}
|
|
1752
1710
|
/**
|
|
1753
1711
|
* 3.18 废弃接口: 设置本地摄像头预览画面的镜像模式
|
|
@@ -1771,7 +1729,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1771
1729
|
* @param {Boolean} mirror - 是否开启远端镜像, true:远端画面镜像;false:远端画面非镜像。默认值:false
|
|
1772
1730
|
*/
|
|
1773
1731
|
setVideoEncoderMirror(mirror) {
|
|
1774
|
-
rtcCloud.setVideoEncoderMirror(mirror);
|
|
1732
|
+
this.rtcCloud.setVideoEncoderMirror(mirror);
|
|
1775
1733
|
}
|
|
1776
1734
|
/**
|
|
1777
1735
|
* 3.20 开启大小画面双路编码模式
|
|
@@ -1796,7 +1754,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1796
1754
|
*/
|
|
1797
1755
|
enableSmallVideoStream(enable, params) {
|
|
1798
1756
|
if (params instanceof trtc_define_1.TRTCVideoEncParam) {
|
|
1799
|
-
rtcCloud.enableSmallVideoStream(enable, params);
|
|
1757
|
+
this.rtcCloud.enableSmallVideoStream(enable, params.videoResolution, params.resMode, params.videoFps, params.videoBitrate, params.minVideoBitrate, params.enableAdjustRes);
|
|
1800
1758
|
}
|
|
1801
1759
|
else {
|
|
1802
1760
|
console.error('enableSmallVideoStream, params is not instanceof TRTCVideoEncParam!');
|
|
@@ -1814,7 +1772,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1814
1772
|
* - TRTCVideoStreamTypeSmall: 小画面视频流
|
|
1815
1773
|
*/
|
|
1816
1774
|
setRemoteVideoStreamType(userId, type) {
|
|
1817
|
-
rtcCloud.setRemoteVideoStreamType(userId, type);
|
|
1775
|
+
this.rtcCloud.setRemoteVideoStreamType(userId, type);
|
|
1818
1776
|
}
|
|
1819
1777
|
/**
|
|
1820
1778
|
* 3.22 视频画面截图
|
|
@@ -1827,9 +1785,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1827
1785
|
*
|
|
1828
1786
|
*/
|
|
1829
1787
|
snapshotVideo(userId, type) {
|
|
1830
|
-
|
|
1831
|
-
const TRTC_SNAPSHOT_SOURCE_TYPE_VIEW = 0;
|
|
1832
|
-
rtcCloud.snapshotVideo(userId, type, TRTC_SNAPSHOT_SOURCE_TYPE_VIEW);
|
|
1788
|
+
this.rtcCloud.snapshotVideo(userId, type);
|
|
1833
1789
|
}
|
|
1834
1790
|
/**
|
|
1835
1791
|
* 3.23 废弃接口: 设定观看方优先选择的视频质量
|
|
@@ -1868,7 +1824,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1868
1824
|
if (quality === undefined) {
|
|
1869
1825
|
quality = this.audioQuality;
|
|
1870
1826
|
}
|
|
1871
|
-
rtcCloud.startLocalAudio(quality);
|
|
1827
|
+
this.rtcCloud.startLocalAudio(quality);
|
|
1872
1828
|
}
|
|
1873
1829
|
/**
|
|
1874
1830
|
* 4.2 关闭本地音频的采集和上行
|
|
@@ -1876,7 +1832,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1876
1832
|
* 当关闭本地音频的采集和上行,房间里的其它成员会收到 onUserAudioAvailable(false) 回调通知。
|
|
1877
1833
|
*/
|
|
1878
1834
|
stopLocalAudio() {
|
|
1879
|
-
rtcCloud.stopLocalAudio();
|
|
1835
|
+
this.rtcCloud.stopLocalAudio();
|
|
1880
1836
|
}
|
|
1881
1837
|
/**
|
|
1882
1838
|
* 4.3 静音本地的音频
|
|
@@ -1889,7 +1845,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1889
1845
|
* @param {Boolean} mute - true:屏蔽;false:开启,默认值:false
|
|
1890
1846
|
*/
|
|
1891
1847
|
muteLocalAudio(mute) {
|
|
1892
|
-
rtcCloud.muteLocalAudio(mute);
|
|
1848
|
+
this.rtcCloud.muteLocalAudio(mute);
|
|
1893
1849
|
}
|
|
1894
1850
|
/**
|
|
1895
1851
|
* 4.4 静音掉某一个用户的声音,同时不再拉取该远端用户的音频数据流
|
|
@@ -1898,7 +1854,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1898
1854
|
* @param {Boolean} mute - true:静音;false:非静音
|
|
1899
1855
|
*/
|
|
1900
1856
|
muteRemoteAudio(userId, mute) {
|
|
1901
|
-
rtcCloud.muteRemoteAudio(userId, mute);
|
|
1857
|
+
this.rtcCloud.muteRemoteAudio(userId, mute);
|
|
1902
1858
|
}
|
|
1903
1859
|
/**
|
|
1904
1860
|
* 4.5 静音掉所有用户的声音,同时不再拉取该远端用户的音频数据流
|
|
@@ -1906,7 +1862,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1906
1862
|
* @param {Boolean} mute - true:静音;false:非静音
|
|
1907
1863
|
*/
|
|
1908
1864
|
muteAllRemoteAudio(mute) {
|
|
1909
|
-
rtcCloud.muteAllRemoteAudio(mute);
|
|
1865
|
+
this.rtcCloud.muteAllRemoteAudio(mute);
|
|
1910
1866
|
}
|
|
1911
1867
|
/**
|
|
1912
1868
|
* 4.6 设置某个远程用户的播放音量
|
|
@@ -1916,7 +1872,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1916
1872
|
*
|
|
1917
1873
|
*/
|
|
1918
1874
|
setRemoteAudioVolume(userId, volume) {
|
|
1919
|
-
rtcCloud.setRemoteAudioVolume(userId, volume);
|
|
1875
|
+
this.rtcCloud.setRemoteAudioVolume(userId, volume);
|
|
1920
1876
|
}
|
|
1921
1877
|
/**
|
|
1922
1878
|
* 4.7 设置 SDK 采集音量
|
|
@@ -1924,7 +1880,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1924
1880
|
* @param {Number} volume - 音量大小,取值0 - 100,默认值为100
|
|
1925
1881
|
*/
|
|
1926
1882
|
setAudioCaptureVolume(volume) {
|
|
1927
|
-
rtcCloud.setAudioCaptureVolume(volume);
|
|
1883
|
+
this.rtcCloud.setAudioCaptureVolume(volume);
|
|
1928
1884
|
}
|
|
1929
1885
|
/**
|
|
1930
1886
|
* 4.8 获取 SDK 采集音量
|
|
@@ -1932,7 +1888,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1932
1888
|
* @return {Number} SDK 采集音量
|
|
1933
1889
|
*/
|
|
1934
1890
|
getAudioCaptureVolume() {
|
|
1935
|
-
return rtcCloud.getAudioCaptureVolume();
|
|
1891
|
+
return this.rtcCloud.getAudioCaptureVolume();
|
|
1936
1892
|
}
|
|
1937
1893
|
/**
|
|
1938
1894
|
* 4.9 设置 SDK 播放音量
|
|
@@ -1944,7 +1900,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1944
1900
|
* @param {Number} volume - 音量大小,取值0 - 100,默认值为100
|
|
1945
1901
|
*/
|
|
1946
1902
|
setAudioPlayoutVolume(volume) {
|
|
1947
|
-
rtcCloud.setAudioPlayoutVolume(volume);
|
|
1903
|
+
this.rtcCloud.setAudioPlayoutVolume(volume);
|
|
1948
1904
|
}
|
|
1949
1905
|
/**
|
|
1950
1906
|
* 4.10 获取 SDK 播放音量
|
|
@@ -1952,7 +1908,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1952
1908
|
* @return {Number} SDK 播放音量
|
|
1953
1909
|
*/
|
|
1954
1910
|
getAudioPlayoutVolume() {
|
|
1955
|
-
return rtcCloud.getAudioPlayoutVolume();
|
|
1911
|
+
return this.rtcCloud.getAudioPlayoutVolume();
|
|
1956
1912
|
}
|
|
1957
1913
|
/**
|
|
1958
1914
|
* 4.11 启用或关闭音量大小提示
|
|
@@ -1964,7 +1920,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1964
1920
|
* @param {Number} interval - 设置 onUserVoiceVolume 回调的触发间隔,单位为ms,最小间隔为100ms,如果小于等于0则会关闭回调,建议设置为300ms
|
|
1965
1921
|
*/
|
|
1966
1922
|
enableAudioVolumeEvaluation(interval) {
|
|
1967
|
-
rtcCloud.enableAudioVolumeEvaluation(interval);
|
|
1923
|
+
this.rtcCloud.enableAudioVolumeEvaluation(interval);
|
|
1968
1924
|
}
|
|
1969
1925
|
/**
|
|
1970
1926
|
* 4.12 开始录音
|
|
@@ -1976,25 +1932,11 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1976
1932
|
* 注意:录音文件路径需精确到文件名及格式后缀,格式后缀决定录制文件的格式。
|
|
1977
1933
|
* 例如:指定路径为 path/to/audio.aac,则会生成一个 AAC 格式的文件。目前支持的格式有 PCM, WAV, AAC
|
|
1978
1934
|
*
|
|
1979
|
-
* @
|
|
1980
|
-
* @params {String} params.filePath - 文件路径(必填),录音文件的保存路径。该路径需要用户自行指定,请确保路径存在且可写
|
|
1981
|
-
* @params {TRTCAudioRecordingContent} params.recordingContent - 音频录制内容类型
|
|
1935
|
+
* @param {String} path - 录音文件路径(必填),录音文件的保存路径,该路径需要用户自行指定,请确保路径存在且可写。
|
|
1982
1936
|
* @return {Number} 0:成功;-1:录音已开始;-2:文件或目录创建失败;-3:后缀指定的音频格式不支持
|
|
1983
|
-
*
|
|
1984
|
-
* 注意:
|
|
1985
|
-
* - 在 9.3 之前的版本,params 为 string 代表 录音文件路径(必填), 9.3 以及以后同时支持 string 类型和 TRTCAudioRecordingParams。
|
|
1986
1937
|
*/
|
|
1987
|
-
startAudioRecording(
|
|
1988
|
-
|
|
1989
|
-
return rtcCloud.startAudioRecording(params);
|
|
1990
|
-
}
|
|
1991
|
-
if (typeof params === 'string') {
|
|
1992
|
-
const path = params;
|
|
1993
|
-
const recordParams = new trtc_define_1.TRTCAudioRecordingParams(path);
|
|
1994
|
-
return rtcCloud.startAudioRecording(recordParams);
|
|
1995
|
-
}
|
|
1996
|
-
console.error('startAudioRecording, params is not instanceof TRTCAudioRecordingParams!');
|
|
1997
|
-
return -1;
|
|
1938
|
+
startAudioRecording(path) {
|
|
1939
|
+
return this.rtcCloud.startAudioRecording(path);
|
|
1998
1940
|
}
|
|
1999
1941
|
/**
|
|
2000
1942
|
* 4.13 停止录音
|
|
@@ -2002,7 +1944,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2002
1944
|
* 如果调用 exitRoom 时还在录音,录音会自动停止。
|
|
2003
1945
|
*/
|
|
2004
1946
|
stopAudioRecording() {
|
|
2005
|
-
rtcCloud.stopAudioRecording();
|
|
1947
|
+
this.rtcCloud.stopAudioRecording();
|
|
2006
1948
|
}
|
|
2007
1949
|
/**
|
|
2008
1950
|
* 4.14 废弃接口: 设置音频质量
|
|
@@ -2028,7 +1970,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2028
1970
|
* 5.1 获取摄像头设备列表
|
|
2029
1971
|
*
|
|
2030
1972
|
* @example
|
|
2031
|
-
* var cameralist = rtcCloud.getCameraDevicesList();
|
|
1973
|
+
* var cameralist = this.rtcCloud.getCameraDevicesList();
|
|
2032
1974
|
* for (i=0;i<cameralist.length;i++) {
|
|
2033
1975
|
* var camera = cameralist[i];
|
|
2034
1976
|
* console.info("camera deviceName: " + camera.deviceName + " deviceId:" + camera.deviceId);
|
|
@@ -2036,7 +1978,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2036
1978
|
* @return {TRTCDeviceInfo[]} 摄像头管理器列表
|
|
2037
1979
|
*/
|
|
2038
1980
|
getCameraDevicesList() {
|
|
2039
|
-
return rtcCloud.
|
|
1981
|
+
return this.rtcCloud.getCameraDevicesList();
|
|
2040
1982
|
}
|
|
2041
1983
|
/**
|
|
2042
1984
|
* 5.2 设置要使用的摄像头
|
|
@@ -2044,7 +1986,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2044
1986
|
* @param {String} deviceId - 从 getCameraDevicesList 中得到的设备 ID
|
|
2045
1987
|
*/
|
|
2046
1988
|
setCurrentCameraDevice(deviceId) {
|
|
2047
|
-
rtcCloud.
|
|
1989
|
+
this.rtcCloud.setCurrentCameraDevice(deviceId);
|
|
2048
1990
|
}
|
|
2049
1991
|
/**
|
|
2050
1992
|
* 5.3 获取当前使用的摄像头
|
|
@@ -2052,7 +1994,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2052
1994
|
* @return {TRTCDeviceInfo} 设备信息,能获取设备 ID 和设备名称
|
|
2053
1995
|
*/
|
|
2054
1996
|
getCurrentCameraDevice() {
|
|
2055
|
-
return rtcCloud.
|
|
1997
|
+
return this.rtcCloud.getCurrentCameraDevice();
|
|
2056
1998
|
}
|
|
2057
1999
|
/////////////////////////////////////////////////////////////////////////////////
|
|
2058
2000
|
//
|
|
@@ -2063,7 +2005,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2063
2005
|
* 6.1 获取麦克风设备列表
|
|
2064
2006
|
*
|
|
2065
2007
|
* @example
|
|
2066
|
-
* var miclist = rtcCloud.getMicDevicesList();
|
|
2008
|
+
* var miclist = this.rtcCloud.getMicDevicesList();
|
|
2067
2009
|
* for (i=0;i<miclist.length;i++) {
|
|
2068
2010
|
* var mic = miclist[i];
|
|
2069
2011
|
* console.info("mic deviceName: " + mic.deviceName + " deviceId:" + mic.deviceId);
|
|
@@ -2071,7 +2013,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2071
2013
|
* @return {TRTCDeviceInfo[]} 麦克风管理器列表
|
|
2072
2014
|
*/
|
|
2073
2015
|
getMicDevicesList() {
|
|
2074
|
-
return rtcCloud.
|
|
2016
|
+
return this.rtcCloud.getMicDevicesList();
|
|
2075
2017
|
}
|
|
2076
2018
|
/**
|
|
2077
2019
|
* 6.2 获取当前选择的麦克风
|
|
@@ -2079,7 +2021,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2079
2021
|
* @return {TRTCDeviceInfo} 设备信息,能获取设备 ID 和设备名称
|
|
2080
2022
|
*/
|
|
2081
2023
|
getCurrentMicDevice() {
|
|
2082
|
-
return rtcCloud.
|
|
2024
|
+
return this.rtcCloud.getCurrentMicDevice();
|
|
2083
2025
|
}
|
|
2084
2026
|
/**
|
|
2085
2027
|
* 6.3 设置要使用的麦克风
|
|
@@ -2089,7 +2031,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2089
2031
|
* @param {String} micId - 从 getMicDevicesList 中得到的设备 ID
|
|
2090
2032
|
*/
|
|
2091
2033
|
setCurrentMicDevice(micId) {
|
|
2092
|
-
rtcCloud.
|
|
2034
|
+
this.rtcCloud.setCurrentMicDevice(micId);
|
|
2093
2035
|
}
|
|
2094
2036
|
/**
|
|
2095
2037
|
* 6.4 获取系统当前麦克风设备音量
|
|
@@ -2098,7 +2040,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2098
2040
|
* @return {Number} 音量值,范围是0 - 100
|
|
2099
2041
|
*/
|
|
2100
2042
|
getCurrentMicDeviceVolume() {
|
|
2101
|
-
return rtcCloud.
|
|
2043
|
+
return this.rtcCloud.getCurrentMicDeviceVolume();
|
|
2102
2044
|
}
|
|
2103
2045
|
/**
|
|
2104
2046
|
* 6.5 设置系统当前麦克风设备的音量
|
|
@@ -2107,7 +2049,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2107
2049
|
* @param {Number} volume - 麦克风音量值,范围0 - 100
|
|
2108
2050
|
*/
|
|
2109
2051
|
setCurrentMicDeviceVolume(volume) {
|
|
2110
|
-
rtcCloud.
|
|
2052
|
+
this.rtcCloud.setCurrentMicDeviceVolume(volume);
|
|
2111
2053
|
}
|
|
2112
2054
|
/**
|
|
2113
2055
|
* 6.6 设置系统当前麦克风设备的静音状态
|
|
@@ -2115,7 +2057,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2115
2057
|
* @param {Boolean} mute 设置为 true 时,麦克风设备静音;设置为 false时,麦克风设备取消静音
|
|
2116
2058
|
*/
|
|
2117
2059
|
setCurrentMicDeviceMute(mute) {
|
|
2118
|
-
rtcCloud.
|
|
2060
|
+
this.rtcCloud.setCurrentMicDeviceMute(mute);
|
|
2119
2061
|
}
|
|
2120
2062
|
/**
|
|
2121
2063
|
* 6.7 获取系统当前麦克风设备是否静音
|
|
@@ -2123,13 +2065,13 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2123
2065
|
* @return {Boolean} 静音状态
|
|
2124
2066
|
*/
|
|
2125
2067
|
getCurrentMicDeviceMute() {
|
|
2126
|
-
return rtcCloud.
|
|
2068
|
+
return this.rtcCloud.getCurrentMicDeviceMute();
|
|
2127
2069
|
}
|
|
2128
2070
|
/**
|
|
2129
2071
|
* 6.8 获取扬声器设备列表
|
|
2130
2072
|
*
|
|
2131
2073
|
* @example
|
|
2132
|
-
* var speakerlist = rtcCloud.getSpeakerDevicesList();
|
|
2074
|
+
* var speakerlist = this.rtcCloud.getSpeakerDevicesList();
|
|
2133
2075
|
* for (i=0;i<speakerlist.length;i++) {
|
|
2134
2076
|
* var speaker = speakerlist[i];
|
|
2135
2077
|
* console.info("mic deviceName: " + speaker.deviceName + " deviceId:" + speaker.deviceId);
|
|
@@ -2137,7 +2079,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2137
2079
|
* @return {TRTCDeviceInfo[]} 扬声器管理器列表
|
|
2138
2080
|
*/
|
|
2139
2081
|
getSpeakerDevicesList() {
|
|
2140
|
-
return rtcCloud.
|
|
2082
|
+
return this.rtcCloud.getSpeakerDevicesList();
|
|
2141
2083
|
}
|
|
2142
2084
|
/**
|
|
2143
2085
|
* 6.9 获取当前的扬声器设备
|
|
@@ -2145,7 +2087,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2145
2087
|
* @return {TRTCDeviceInfo} 设备信息,能获取设备 ID 和设备名称
|
|
2146
2088
|
*/
|
|
2147
2089
|
getCurrentSpeakerDevice() {
|
|
2148
|
-
return rtcCloud.
|
|
2090
|
+
return this.rtcCloud.getCurrentSpeakerDevice();
|
|
2149
2091
|
}
|
|
2150
2092
|
/**
|
|
2151
2093
|
* 6.10 设置要使用的扬声器
|
|
@@ -2153,7 +2095,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2153
2095
|
* @param {String} speakerId - 从 getSpeakerDevicesList 中得到的设备 ID
|
|
2154
2096
|
*/
|
|
2155
2097
|
setCurrentSpeakerDevice(speakerId) {
|
|
2156
|
-
rtcCloud.
|
|
2098
|
+
this.rtcCloud.setCurrentSpeakerDevice(speakerId);
|
|
2157
2099
|
}
|
|
2158
2100
|
/**
|
|
2159
2101
|
* 6.11 获取系统当前扬声器设备音量
|
|
@@ -2165,7 +2107,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2165
2107
|
* @return {Number} 扬声器音量,范围0 - 100
|
|
2166
2108
|
*/
|
|
2167
2109
|
getCurrentSpeakerVolume() {
|
|
2168
|
-
return rtcCloud.
|
|
2110
|
+
return this.rtcCloud.getCurrentSpeakerVolume();
|
|
2169
2111
|
}
|
|
2170
2112
|
/**
|
|
2171
2113
|
* 6.12 设置系统当前扬声器设备音量
|
|
@@ -2177,7 +2119,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2177
2119
|
* @param {Number} volume - 设置的扬声器音量,范围0 - 100
|
|
2178
2120
|
*/
|
|
2179
2121
|
setCurrentSpeakerVolume(volume) {
|
|
2180
|
-
rtcCloud.
|
|
2122
|
+
this.rtcCloud.setCurrentSpeakerVolume(volume);
|
|
2181
2123
|
}
|
|
2182
2124
|
/**
|
|
2183
2125
|
* 6.13 设置系统当前扬声器设备的静音状态
|
|
@@ -2185,7 +2127,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2185
2127
|
* @param {Boolean} mute 设置为 true 时,扬声器设备静音;设置为 false时,扬声器设备取消静音
|
|
2186
2128
|
*/
|
|
2187
2129
|
setCurrentSpeakerDeviceMute(mute) {
|
|
2188
|
-
rtcCloud.
|
|
2130
|
+
this.rtcCloud.setCurrentSpeakerDeviceMute(mute);
|
|
2189
2131
|
}
|
|
2190
2132
|
/**
|
|
2191
2133
|
* 6.14 获取系统当前扬声器设备是否静音
|
|
@@ -2193,7 +2135,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2193
2135
|
* @return {Boolean} 静音状态
|
|
2194
2136
|
*/
|
|
2195
2137
|
getCurrentSpeakerDeviceMute() {
|
|
2196
|
-
return rtcCloud.
|
|
2138
|
+
return this.rtcCloud.getCurrentSpeakerDeviceMute();
|
|
2197
2139
|
}
|
|
2198
2140
|
/////////////////////////////////////////////////////////////////////////////////
|
|
2199
2141
|
//
|
|
@@ -2214,7 +2156,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2214
2156
|
* @param {Number} ruddiness - 红润级别,取值范围0 - 9,0表示关闭,1 - 9值越大,效果越明显,该参数 windows 平台暂未生效
|
|
2215
2157
|
*/
|
|
2216
2158
|
setBeautyStyle(style, beauty, white, ruddiness) {
|
|
2217
|
-
rtcCloud.setBeautyStyle(style, beauty, white, ruddiness);
|
|
2159
|
+
this.rtcCloud.setBeautyStyle(style, beauty, white, ruddiness);
|
|
2218
2160
|
}
|
|
2219
2161
|
/**
|
|
2220
2162
|
* 7.2 设置水印
|
|
@@ -2241,9 +2183,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2241
2183
|
setWaterMark(streamType, srcData, srcType, nWidth, nHeight, xOffset, yOffset, fWidthRatio) {
|
|
2242
2184
|
if (srcData === null || srcData === undefined || srcType === null || srcType === undefined) {
|
|
2243
2185
|
srcType = -1; //关闭水印
|
|
2244
|
-
srcData = new ArrayBuffer(0);
|
|
2245
2186
|
}
|
|
2246
|
-
rtcCloud.setWaterMark(streamType, srcData, srcType, nWidth, nHeight, xOffset, yOffset, fWidthRatio);
|
|
2187
|
+
this.rtcCloud.setWaterMark(streamType, srcData, srcType, nWidth, nHeight, xOffset, yOffset, fWidthRatio);
|
|
2247
2188
|
}
|
|
2248
2189
|
/////////////////////////////////////////////////////////////////////////////////
|
|
2249
2190
|
//
|
|
@@ -2336,14 +2277,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2336
2277
|
* @return {TRTCScreenCaptureSourceInfo[]} 窗口列表包括屏幕
|
|
2337
2278
|
*/
|
|
2338
2279
|
getScreenCaptureSources(thumbWidth, thumbHeight, iconWidth, iconHeight) {
|
|
2339
|
-
|
|
2340
|
-
width: thumbWidth, height: thumbHeight
|
|
2341
|
-
}, {
|
|
2342
|
-
width: iconWidth, height: iconHeight
|
|
2343
|
-
});
|
|
2344
|
-
return sourceList.map((item) => {
|
|
2345
|
-
return Object.assign(Object.assign({}, item), { thumbBGRA: Object.assign(Object.assign({}, item.thumbBGRA), { buffer: this._BGRA2RGBA(item.thumbBGRA.buffer, item.thumbBGRA.width, item.thumbBGRA.height) }), iconBGRA: Object.assign(Object.assign({}, item.iconBGRA), { buffer: this._BGRA2RGBA(item.iconBGRA.buffer, item.iconBGRA.width, item.iconBGRA.height) }) });
|
|
2346
|
-
});
|
|
2280
|
+
return this.rtcCloud.getScreenCaptureSources(thumbWidth, thumbHeight, iconWidth, iconHeight);
|
|
2347
2281
|
}
|
|
2348
2282
|
/**
|
|
2349
2283
|
* 8.6 设置屏幕共享参数,该方法在屏幕共享过程中也可以调用
|
|
@@ -2356,11 +2290,6 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2356
2290
|
* - 共享整个窗口:sourceInfoList 中 type 为 Window 的 source,captureRect 设为 { 0, 0, 0, 0 }
|
|
2357
2291
|
* - 共享窗口区域:sourceInfoList 中 type 为 Window 的 source,captureRect 设为非 NULL,例如 { 100, 100, 300, 300 }
|
|
2358
2292
|
*
|
|
2359
|
-
* @param {TRTCScreenCaptureSourceInfo} source - 指定分享源,详情参考TRTCScreenCaptureSourceInfo 定义
|
|
2360
|
-
* @param {Rect} captureRect - 指定捕获的区域
|
|
2361
|
-
* @param {TRTCScreenCaptureProperty} property - 指定屏幕分享目标的属性,包括捕获鼠标,高亮捕获窗口等,详情参考TRTCScreenCaptureProperty 定义
|
|
2362
|
-
*
|
|
2363
|
-
* 废弃参数使用方法(针对 9.3 以下版本):
|
|
2364
2293
|
* @param {TRTCScreenCaptureSourceType} type - 采集源类型
|
|
2365
2294
|
* - TRTCScreenCaptureSourceTypeWindow: 该分享目标是某一个Windows窗口
|
|
2366
2295
|
* - TRTCScreenCaptureSourceTypeScreen: 该分享目标是整个Windows桌面
|
|
@@ -2375,26 +2304,16 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2375
2304
|
* @param {Boolean} captureMouse - 指定是否捕获鼠标指针
|
|
2376
2305
|
* @param {Boolean} highlightWindow - 指定是否高亮正在共享的窗口,以及当捕获图像被遮挡时高亮遮挡窗口提示用户移走遮挡
|
|
2377
2306
|
*/
|
|
2378
|
-
selectScreenCaptureTarget(
|
|
2379
|
-
if (
|
|
2380
|
-
return rtcCloud.selectScreenCaptureTarget(
|
|
2381
|
-
}
|
|
2382
|
-
const type = source;
|
|
2383
|
-
const sourceId = captureRect;
|
|
2384
|
-
const sourcename = property;
|
|
2385
|
-
if (sourceId !== null && sourceId !== undefined && sourcename !== null
|
|
2386
|
-
&& sourcename !== undefined && deprecatedCaptureRect !== undefined && captureMouse !== undefined
|
|
2387
|
-
&& highlightWindow !== undefined) {
|
|
2388
|
-
const selSource = new trtc_define_1.TRTCScreenCaptureSourceInfo(type, sourceId, sourcename);
|
|
2389
|
-
const selProperty = new trtc_define_1.TRTCScreenCaptureProperty(captureMouse, highlightWindow);
|
|
2390
|
-
return rtcCloud.selectScreenCaptureTarget(selSource, deprecatedCaptureRect, selProperty);
|
|
2307
|
+
selectScreenCaptureTarget(type, sourceId, sourcename, captureRect, captureMouse, highlightWindow) {
|
|
2308
|
+
if (sourceId !== null && sourceId !== undefined && sourcename !== null && sourcename !== undefined) {
|
|
2309
|
+
return this.rtcCloud.selectScreenCaptureTarget(type, sourceId, sourcename, captureRect.left, captureRect.top, captureRect.right, captureRect.bottom, captureMouse, highlightWindow);
|
|
2391
2310
|
}
|
|
2392
2311
|
else {
|
|
2393
2312
|
console.error('selectScreenCaptureTarget, sourceId or sourcename is undefined!');
|
|
2394
2313
|
}
|
|
2395
2314
|
}
|
|
2396
2315
|
/**
|
|
2397
|
-
* 8.7
|
|
2316
|
+
* 8.7 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。(暂不支持 mac 平台预览界面)
|
|
2398
2317
|
*
|
|
2399
2318
|
* 注意:
|
|
2400
2319
|
* 一个用户同时最多只能上传一条主路(TRTCVideoStreamTypeBig)画面和一条辅路(TRTCVideoStreamTypeSub)画面,
|
|
@@ -2420,24 +2339,23 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2420
2339
|
this.addLocalVideoRenderCallback();
|
|
2421
2340
|
}
|
|
2422
2341
|
if (params) {
|
|
2423
|
-
rtcCloud.startScreenCapture(
|
|
2342
|
+
this.rtcCloud.startScreenCapture(type, params.videoResolution, params.resMode, params.videoFps, params.videoBitrate, params.minVideoBitrate, params.enableAdjustRes);
|
|
2424
2343
|
}
|
|
2425
2344
|
else {
|
|
2426
|
-
|
|
2427
|
-
rtcCloud.startScreenCapture(EMPTY_VIEW, type, defaultParams);
|
|
2345
|
+
this.rtcCloud.startScreenCapture(type);
|
|
2428
2346
|
}
|
|
2429
2347
|
}
|
|
2430
2348
|
/**
|
|
2431
2349
|
* 8.8 暂停屏幕分享
|
|
2432
2350
|
*/
|
|
2433
2351
|
pauseScreenCapture() {
|
|
2434
|
-
rtcCloud.pauseScreenCapture();
|
|
2352
|
+
this.rtcCloud.pauseScreenCapture();
|
|
2435
2353
|
}
|
|
2436
2354
|
/**
|
|
2437
2355
|
* 8.9 恢复屏幕分享
|
|
2438
2356
|
*/
|
|
2439
2357
|
resumeScreenCapture() {
|
|
2440
|
-
rtcCloud.resumeScreenCapture();
|
|
2358
|
+
this.rtcCloud.resumeScreenCapture();
|
|
2441
2359
|
}
|
|
2442
2360
|
/**
|
|
2443
2361
|
* 8.10 停止屏幕分享
|
|
@@ -2445,7 +2363,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2445
2363
|
stopScreenCapture() {
|
|
2446
2364
|
var key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeSub);
|
|
2447
2365
|
this._destroyRender(key, null);
|
|
2448
|
-
rtcCloud.stopScreenCapture();
|
|
2366
|
+
this.rtcCloud.stopScreenCapture();
|
|
2449
2367
|
}
|
|
2450
2368
|
/**
|
|
2451
2369
|
* 8.11 设置辅流(屏幕分享)的编码器参数
|
|
@@ -2466,7 +2384,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2466
2384
|
*/
|
|
2467
2385
|
setSubStreamEncoderParam(params) {
|
|
2468
2386
|
if (params instanceof trtc_define_1.TRTCVideoEncParam) {
|
|
2469
|
-
rtcCloud.setSubStreamEncoderParam(params);
|
|
2387
|
+
this.rtcCloud.setSubStreamEncoderParam(params.videoResolution, params.resMode, params.videoFps, params.videoBitrate, params.minVideoBitrate, params.enableAdjustRes);
|
|
2470
2388
|
}
|
|
2471
2389
|
else {
|
|
2472
2390
|
console.error('setSubStreamEncoderParam, params is not instanceof TRTCVideoEncParam!');
|
|
@@ -2480,7 +2398,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2480
2398
|
* @param {Number} volume - 设置的混音音量大小,范围0 - 100
|
|
2481
2399
|
*/
|
|
2482
2400
|
setSubStreamMixVolume(volume) {
|
|
2483
|
-
rtcCloud.setSubStreamMixVolume(volume);
|
|
2401
|
+
this.rtcCloud.setSubStreamMixVolume(volume);
|
|
2484
2402
|
}
|
|
2485
2403
|
/**
|
|
2486
2404
|
* 8.13 将指定窗口加入屏幕分享的排除列表中,加入排除列表中的窗口不会被分享出去
|
|
@@ -2492,7 +2410,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2492
2410
|
* - Windows下该方法添加的窗口列表会在退房后清空;Mac下在退出房间时不会自动清空,需要调用一次removeAllExcludedShareWindow()方法清空列表。
|
|
2493
2411
|
*/
|
|
2494
2412
|
addExcludedShareWindow(win) {
|
|
2495
|
-
rtcCloud.addExcludedShareWindow(win);
|
|
2413
|
+
this.rtcCloud.addExcludedShareWindow(win);
|
|
2496
2414
|
}
|
|
2497
2415
|
/**
|
|
2498
2416
|
* 8.14 将指定窗口从屏幕分享的排除列表中移除
|
|
@@ -2501,7 +2419,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2501
2419
|
* - 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
|
|
2502
2420
|
*/
|
|
2503
2421
|
removeExcludedShareWindow(win) {
|
|
2504
|
-
rtcCloud.removeExcludedShareWindow(win);
|
|
2422
|
+
this.rtcCloud.removeExcludedShareWindow(win);
|
|
2505
2423
|
}
|
|
2506
2424
|
/**
|
|
2507
2425
|
* 8.15 将所有窗口从屏幕分享的排除列表中移除
|
|
@@ -2509,7 +2427,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2509
2427
|
* @note 该方法只有在 TRTCScreenCaptureSourceInfo 中的 type 指定为 TRTCScreenCaptureSourceTypeScreen 时生效,即分享屏幕时生效
|
|
2510
2428
|
*/
|
|
2511
2429
|
removeAllExcludedShareWindow() {
|
|
2512
|
-
rtcCloud.removeAllExcludedShareWindow();
|
|
2430
|
+
this.rtcCloud.removeAllExcludedShareWindow();
|
|
2513
2431
|
}
|
|
2514
2432
|
/////////////////////////////////////////////////////////////////////////////////
|
|
2515
2433
|
//
|
|
@@ -2607,7 +2525,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2607
2525
|
* @return {Boolean} true:消息已经发出;false:消息发送失败
|
|
2608
2526
|
*/
|
|
2609
2527
|
sendCustomCmdMsg(cmdId, msg, reliable, ordered) {
|
|
2610
|
-
return rtcCloud.sendCustomCmdMsg(cmdId, msg,
|
|
2528
|
+
return this.rtcCloud.sendCustomCmdMsg(cmdId, msg, reliable, ordered);
|
|
2611
2529
|
}
|
|
2612
2530
|
/**
|
|
2613
2531
|
* 10.2 将小数据量的自定义数据嵌入视频帧中
|
|
@@ -2630,7 +2548,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2630
2548
|
* @return {Boolean} true:消息已通过限制,等待后续视频帧发送;false:消息被限制发送
|
|
2631
2549
|
*/
|
|
2632
2550
|
sendSEIMsg(msg, repeatCount) {
|
|
2633
|
-
return rtcCloud.sendSEIMsg(msg,
|
|
2551
|
+
return this.rtcCloud.sendSEIMsg(msg, repeatCount);
|
|
2634
2552
|
}
|
|
2635
2553
|
/////////////////////////////////////////////////////////////////////////////////
|
|
2636
2554
|
//
|
|
@@ -2744,18 +2662,18 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2744
2662
|
*/
|
|
2745
2663
|
startSystemAudioLoopback(path) {
|
|
2746
2664
|
if (path === undefined || path === null) {
|
|
2747
|
-
rtcCloud.startSystemAudioLoopback(
|
|
2665
|
+
this.rtcCloud.startSystemAudioLoopback(null);
|
|
2748
2666
|
}
|
|
2749
2667
|
else {
|
|
2750
2668
|
path = path.replace('file:///', '');
|
|
2751
|
-
rtcCloud.startSystemAudioLoopback(path);
|
|
2669
|
+
this.rtcCloud.startSystemAudioLoopback(path);
|
|
2752
2670
|
}
|
|
2753
2671
|
}
|
|
2754
2672
|
/**
|
|
2755
2673
|
* 11.11 关闭系统声音采集
|
|
2756
2674
|
*/
|
|
2757
2675
|
stopSystemAudioLoopback() {
|
|
2758
|
-
rtcCloud.stopSystemAudioLoopback();
|
|
2676
|
+
this.rtcCloud.stopSystemAudioLoopback();
|
|
2759
2677
|
}
|
|
2760
2678
|
/**
|
|
2761
2679
|
* 11.12 设置系统声音采集的音量
|
|
@@ -2763,7 +2681,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2763
2681
|
* @param {Number} volume - 音量大小,取值范围为0 - 100。
|
|
2764
2682
|
*/
|
|
2765
2683
|
setSystemAudioLoopbackVolume(volume) {
|
|
2766
|
-
rtcCloud.setSystemAudioLoopbackVolume(volume);
|
|
2684
|
+
this.rtcCloud.setSystemAudioLoopbackVolume(volume);
|
|
2767
2685
|
}
|
|
2768
2686
|
/**
|
|
2769
2687
|
* 11.13 启动播放背景音乐
|
|
@@ -2796,25 +2714,25 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2796
2714
|
* )
|
|
2797
2715
|
*/
|
|
2798
2716
|
startPlayMusic(musicParam, callbackMap) {
|
|
2799
|
-
|
|
2717
|
+
let onStartCb = (id, errCode) => {
|
|
2800
2718
|
this.fire('onPlayBGMBegin', errCode);
|
|
2801
2719
|
if (callbackMap && callbackMap.onStart) {
|
|
2802
2720
|
callbackMap.onStart(id, errCode);
|
|
2803
2721
|
}
|
|
2804
2722
|
};
|
|
2805
|
-
|
|
2723
|
+
let onPlayProgressCb = (id, curPtsMS, durationMS) => {
|
|
2806
2724
|
this.fire('onPlayBGMProgress', curPtsMS, durationMS);
|
|
2807
2725
|
if (callbackMap && callbackMap.onPlayProgress) {
|
|
2808
2726
|
callbackMap.onPlayProgress(id, curPtsMS, durationMS);
|
|
2809
2727
|
}
|
|
2810
2728
|
};
|
|
2811
|
-
|
|
2729
|
+
let onCompleteCb = (id, errCode) => {
|
|
2812
2730
|
this.fire('onPlayBGMComplete', errCode);
|
|
2813
2731
|
if (callbackMap && callbackMap.onComplete) {
|
|
2814
2732
|
callbackMap.onComplete(id, errCode);
|
|
2815
2733
|
}
|
|
2816
2734
|
};
|
|
2817
|
-
rtcCloud.startPlayMusic(musicParam);
|
|
2735
|
+
this.rtcCloud.startPlayMusic(musicParam.id, musicParam.path, musicParam.loopCount, musicParam.publish, musicParam.isShortFile, musicParam.startTimeMS, musicParam.endTimeMS, onStartCb, onPlayProgressCb, onCompleteCb);
|
|
2818
2736
|
}
|
|
2819
2737
|
/**
|
|
2820
2738
|
* 11.14 停止播放背景音乐
|
|
@@ -2822,7 +2740,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2822
2740
|
* @param {Number} id 音乐 ID
|
|
2823
2741
|
*/
|
|
2824
2742
|
stopPlayMusic(id) {
|
|
2825
|
-
rtcCloud.stopPlayMusic(id);
|
|
2743
|
+
this.rtcCloud.stopPlayMusic(id);
|
|
2826
2744
|
}
|
|
2827
2745
|
/**
|
|
2828
2746
|
* 11.15 暂停播放背景音乐
|
|
@@ -2830,7 +2748,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2830
2748
|
* @param {Number} id 音乐 ID
|
|
2831
2749
|
*/
|
|
2832
2750
|
pausePlayMusic(id) {
|
|
2833
|
-
rtcCloud.pausePlayMusic(id);
|
|
2751
|
+
this.rtcCloud.pausePlayMusic(id);
|
|
2834
2752
|
}
|
|
2835
2753
|
/**
|
|
2836
2754
|
* 11.16 恢复播放背景音乐
|
|
@@ -2838,7 +2756,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2838
2756
|
* @param {Number} id 音乐 ID
|
|
2839
2757
|
*/
|
|
2840
2758
|
resumePlayMusic(id) {
|
|
2841
|
-
rtcCloud.resumePlayMusic(id);
|
|
2759
|
+
this.rtcCloud.resumePlayMusic(id);
|
|
2842
2760
|
}
|
|
2843
2761
|
/**
|
|
2844
2762
|
* 11.17 获取背景音乐文件总时长,单位毫秒
|
|
@@ -2848,7 +2766,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2848
2766
|
*/
|
|
2849
2767
|
getMusicDurationInMS(path) {
|
|
2850
2768
|
path = path.replace('file:///', '');
|
|
2851
|
-
return rtcCloud.getMusicDurationInMS(path);
|
|
2769
|
+
return this.rtcCloud.getMusicDurationInMS(path);
|
|
2852
2770
|
}
|
|
2853
2771
|
/**
|
|
2854
2772
|
* 11.18 设置背景音乐播放进度
|
|
@@ -2857,7 +2775,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2857
2775
|
* @param {Number} pts - 单位: 毫秒
|
|
2858
2776
|
*/
|
|
2859
2777
|
seekMusicToPosInTime(id, pts) {
|
|
2860
|
-
return rtcCloud.seekMusicToPosInTime(id, pts);
|
|
2778
|
+
return this.rtcCloud.seekMusicToPosInTime(id, pts);
|
|
2861
2779
|
}
|
|
2862
2780
|
/**
|
|
2863
2781
|
* 11.19 设置背景音乐的音量大小,播放背景音乐混音时使用,用来控制背景音音量大小
|
|
@@ -2865,7 +2783,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2865
2783
|
* @param {Number} volume - 音量大小,100为正常音量,取值范围为0 - 200。
|
|
2866
2784
|
*/
|
|
2867
2785
|
setAllMusicVolume(volume) {
|
|
2868
|
-
return rtcCloud.setAllMusicVolume(volume);
|
|
2786
|
+
return this.rtcCloud.setAllMusicVolume(volume);
|
|
2869
2787
|
}
|
|
2870
2788
|
/**
|
|
2871
2789
|
* 11.20 设置背景音乐本地播放音量的大小
|
|
@@ -2876,7 +2794,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2876
2794
|
* @param {Number} volume - 音量大小,100为正常音量,取值范围为0 - 100;默认值:100
|
|
2877
2795
|
*/
|
|
2878
2796
|
setMusicPlayoutVolume(id, volume) {
|
|
2879
|
-
rtcCloud.setMusicPlayoutVolume(id, volume);
|
|
2797
|
+
this.rtcCloud.setMusicPlayoutVolume(id, volume);
|
|
2880
2798
|
}
|
|
2881
2799
|
/**
|
|
2882
2800
|
* 11.21 设置背景音乐远端播放音量的大小
|
|
@@ -2887,7 +2805,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2887
2805
|
* @param {Number} volume - 音量大小,100为正常音量,取值范围为0 - 100;默认值:100
|
|
2888
2806
|
*/
|
|
2889
2807
|
setMusicPublishVolume(id, volume) {
|
|
2890
|
-
rtcCloud.setMusicPublishVolume(id, volume);
|
|
2808
|
+
this.rtcCloud.setMusicPublishVolume(id, volume);
|
|
2891
2809
|
}
|
|
2892
2810
|
/////////////////////////////////////////////////////////////////////////////////
|
|
2893
2811
|
//
|
|
@@ -2996,49 +2914,20 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2996
2914
|
* 测速结果将会用于优化 SDK 接下来的服务器选择策略,因此推荐您在用户首次通话前先进行一次测速,这将有助于我们选择最佳的服务器。
|
|
2997
2915
|
* 同时,如果测试结果非常不理想,您可以通过醒目的 UI 提示用户选择更好的网络。
|
|
2998
2916
|
*
|
|
2999
|
-
*
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3002
|
-
*
|
|
3003
|
-
*
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
* @param {String} params.userSig - 用户签名
|
|
3008
|
-
* @param {Number} params.expectedUpBandwidth - 预期的上行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
|
|
3009
|
-
* @param {Number} params.expectedDownBandwidth - 预期的下行带宽(kbps,取值范围: 10 ~ 5000,为 0 时不测试)。
|
|
3010
|
-
*
|
|
3011
|
-
* @return 接口调用结果,< 0:失败
|
|
3012
|
-
*/
|
|
3013
|
-
startSpeedTest(params, userId, userSig) {
|
|
3014
|
-
if (params instanceof trtc_define_1.TRTCSpeedTestParams) {
|
|
3015
|
-
return rtcCloud.startSpeedTest({
|
|
3016
|
-
sdkAppId: params.sdkAppId,
|
|
3017
|
-
userId: params.userId,
|
|
3018
|
-
userSig: params.userSig,
|
|
3019
|
-
expectedUpBandwidth: params.expectedUpBandwidth,
|
|
3020
|
-
expectedDownBandwidth: params.expectedDownBandwidth
|
|
3021
|
-
});
|
|
3022
|
-
}
|
|
3023
|
-
if (userId !== undefined && userSig !== undefined) {
|
|
3024
|
-
const sdkAppId = params;
|
|
3025
|
-
const speedTestParams = new trtc_define_1.TRTCSpeedTestParams(sdkAppId, userId, userSig);
|
|
3026
|
-
return rtcCloud.startSpeedTest({
|
|
3027
|
-
sdkAppId: speedTestParams.sdkAppId,
|
|
3028
|
-
userId: speedTestParams.userId,
|
|
3029
|
-
userSig: speedTestParams.userSig,
|
|
3030
|
-
expectedUpBandwidth: speedTestParams.expectedUpBandwidth,
|
|
3031
|
-
expectedDownBandwidth: speedTestParams.expectedDownBandwidth
|
|
3032
|
-
});
|
|
3033
|
-
}
|
|
3034
|
-
console.error('startSpeedTest, param is error');
|
|
3035
|
-
return -1;
|
|
2917
|
+
* 注意:测速本身会消耗一定的流量,所以也会产生少量额外的流量费用。
|
|
2918
|
+
*
|
|
2919
|
+
* @param {Number} sdkAppId - 应用标识
|
|
2920
|
+
* @param {String} userId - 用户标识
|
|
2921
|
+
* @param {String} userSig - 用户签名
|
|
2922
|
+
*/
|
|
2923
|
+
startSpeedTest(sdkAppId, userId, userSig) {
|
|
2924
|
+
this.rtcCloud.startSpeedTest(sdkAppId, userId, userSig);
|
|
3036
2925
|
}
|
|
3037
2926
|
/**
|
|
3038
2927
|
* 13.2 停止网络测速
|
|
3039
2928
|
*/
|
|
3040
2929
|
stopSpeedTest() {
|
|
3041
|
-
rtcCloud.stopSpeedTest();
|
|
2930
|
+
this.rtcCloud.stopSpeedTest();
|
|
3042
2931
|
}
|
|
3043
2932
|
/**
|
|
3044
2933
|
* 13.3 开始进行摄像头测试
|
|
@@ -3058,7 +2947,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3058
2947
|
renderer.setContentMode(trtc_define_1.TRTCVideoFillMode.TRTCVideoFillMode_Fill);
|
|
3059
2948
|
}
|
|
3060
2949
|
this.addLocalVideoRenderCallback();
|
|
3061
|
-
rtcCloud.startCameraDeviceTest(
|
|
2950
|
+
this.rtcCloud.startCameraDeviceTest();
|
|
3062
2951
|
}
|
|
3063
2952
|
else {
|
|
3064
2953
|
console.error('startCameraDeviceTest, view is undefined!');
|
|
@@ -3070,9 +2959,9 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3070
2959
|
stopCameraDeviceTest() {
|
|
3071
2960
|
let key = this.getKey('camera_device_test_view', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
|
|
3072
2961
|
this._destroyRender(key, null);
|
|
3073
|
-
rtcCloud.stopCameraDeviceTest();
|
|
3074
|
-
this.firstVideoFrameList = this.firstVideoFrameList.filter((item)
|
|
3075
|
-
return !(
|
|
2962
|
+
this.rtcCloud.stopCameraDeviceTest();
|
|
2963
|
+
this.firstVideoFrameList = this.firstVideoFrameList.filter(function (item) {
|
|
2964
|
+
return !('' === item.uid && item.type === trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
|
|
3076
2965
|
});
|
|
3077
2966
|
}
|
|
3078
2967
|
/**
|
|
@@ -3085,13 +2974,13 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3085
2974
|
* @param {Number} interval - 反馈音量提示的时间间隔(ms),建议设置到大于 200 毫秒
|
|
3086
2975
|
*/
|
|
3087
2976
|
startMicDeviceTest(interval) {
|
|
3088
|
-
rtcCloud.startMicDeviceTest(interval);
|
|
2977
|
+
this.rtcCloud.startMicDeviceTest(interval);
|
|
3089
2978
|
}
|
|
3090
2979
|
/**
|
|
3091
2980
|
* 13.6 停止麦克风测试
|
|
3092
2981
|
*/
|
|
3093
2982
|
stopMicDeviceTest() {
|
|
3094
|
-
rtcCloud.stopMicDeviceTest();
|
|
2983
|
+
this.rtcCloud.stopMicDeviceTest();
|
|
3095
2984
|
}
|
|
3096
2985
|
/**
|
|
3097
2986
|
* 13.7 开始进行扬声器测试
|
|
@@ -3104,13 +2993,13 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3104
2993
|
*/
|
|
3105
2994
|
startSpeakerDeviceTest(testAudioFilePath) {
|
|
3106
2995
|
testAudioFilePath = testAudioFilePath.replace('file:///', '');
|
|
3107
|
-
rtcCloud.startSpeakerDeviceTest(testAudioFilePath);
|
|
2996
|
+
this.rtcCloud.startSpeakerDeviceTest(testAudioFilePath);
|
|
3108
2997
|
}
|
|
3109
2998
|
/**
|
|
3110
2999
|
* 13.8 停止扬声器测试
|
|
3111
3000
|
*/
|
|
3112
3001
|
stopSpeakerDeviceTest() {
|
|
3113
|
-
rtcCloud.stopSpeakerDeviceTest();
|
|
3002
|
+
this.rtcCloud.stopSpeakerDeviceTest();
|
|
3114
3003
|
}
|
|
3115
3004
|
/////////////////////////////////////////////////////////////////////////////////
|
|
3116
3005
|
//
|
|
@@ -3123,7 +3012,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3123
3012
|
* @return {String} UTF-8 编码的版本号。
|
|
3124
3013
|
*/
|
|
3125
3014
|
getSDKVersion() {
|
|
3126
|
-
return rtcCloud.getSDKVersion();
|
|
3015
|
+
return this.rtcCloud.getSDKVersion();
|
|
3127
3016
|
}
|
|
3128
3017
|
/**
|
|
3129
3018
|
* 14.2 设置 Log 输出级别
|
|
@@ -3138,7 +3027,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3138
3027
|
* - TRTCLogLevelFatal : 只输出 FATAL 级别的 Log
|
|
3139
3028
|
*/
|
|
3140
3029
|
setLogLevel(level) {
|
|
3141
|
-
rtcCloud.setLogLevel(level);
|
|
3030
|
+
this.rtcCloud.setLogLevel(level);
|
|
3142
3031
|
}
|
|
3143
3032
|
/**
|
|
3144
3033
|
* 14.3 启用或禁用控制台日志打印
|
|
@@ -3146,7 +3035,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3146
3035
|
* @param {Boolean} enabled - 指定是否启用,默认为禁止状态
|
|
3147
3036
|
*/
|
|
3148
3037
|
setConsoleEnabled(enabled) {
|
|
3149
|
-
rtcCloud.setConsoleEnabled(enabled);
|
|
3038
|
+
this.rtcCloud.setConsoleEnabled(enabled);
|
|
3150
3039
|
}
|
|
3151
3040
|
/**
|
|
3152
3041
|
* 14.4 启用或禁用 Log 的本地压缩
|
|
@@ -3157,7 +3046,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3157
3046
|
* @param {Boolean} enabled - 指定是否启用,默认为禁止状态
|
|
3158
3047
|
*/
|
|
3159
3048
|
setLogCompressEnabled(enabled) {
|
|
3160
|
-
rtcCloud.setLogCompressEnabled(enabled);
|
|
3049
|
+
this.rtcCloud.setLogCompressEnabled(enabled);
|
|
3161
3050
|
}
|
|
3162
3051
|
/**
|
|
3163
3052
|
* 14.5 设置日志保存路径
|
|
@@ -3170,7 +3059,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3170
3059
|
*/
|
|
3171
3060
|
setLogDirPath(path) {
|
|
3172
3061
|
path = path.replace('file:///', '');
|
|
3173
|
-
rtcCloud.setLogDirPath(path);
|
|
3062
|
+
this.rtcCloud.setLogDirPath(path);
|
|
3174
3063
|
}
|
|
3175
3064
|
/**
|
|
3176
3065
|
* 14.6 设置日志回调
|
|
@@ -3178,7 +3067,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3178
3067
|
*/
|
|
3179
3068
|
setLogCallback(callback) {
|
|
3180
3069
|
if (callback !== undefined) {
|
|
3181
|
-
rtcCloud.setLogCallback(callback);
|
|
3070
|
+
this.rtcCloud.setLogCallback(callback);
|
|
3182
3071
|
}
|
|
3183
3072
|
}
|
|
3184
3073
|
/**
|
|
@@ -3189,7 +3078,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3189
3078
|
* @param {String} jsonStr - 接口及参数描述的 JSON 字符串
|
|
3190
3079
|
*/
|
|
3191
3080
|
callExperimentalAPI(jsonStr) {
|
|
3192
|
-
rtcCloud.callExperimentalAPI(jsonStr);
|
|
3081
|
+
this.rtcCloud.callExperimentalAPI(jsonStr);
|
|
3193
3082
|
}
|
|
3194
3083
|
/////////////////////////////////////////////////////////////////////////////////
|
|
3195
3084
|
//
|
|
@@ -3213,10 +3102,11 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3213
3102
|
else {
|
|
3214
3103
|
this.pixelformate = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
|
|
3215
3104
|
}
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3105
|
+
this.rtcCloud.addLocalVideoRenderCallback((id, type, width, height, timestamp, rotation, data) => {
|
|
3106
|
+
if (this.enableRenderFrame) {
|
|
3107
|
+
this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
|
|
3108
|
+
}
|
|
3109
|
+
}, this.pixelformate);
|
|
3220
3110
|
}
|
|
3221
3111
|
addRemoteVideoRenderCallback(userid) {
|
|
3222
3112
|
if (this.isExternalRenderEnabled || this.renderMode === 3) {
|
|
@@ -3225,9 +3115,11 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3225
3115
|
else {
|
|
3226
3116
|
this.pixelformate = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
|
|
3227
3117
|
}
|
|
3228
|
-
rtcCloud.
|
|
3229
|
-
this.
|
|
3230
|
-
|
|
3118
|
+
this.rtcCloud.addRemoteVideoRenderCallback(userid, (id, type, width, height, timestamp, rotation, data) => {
|
|
3119
|
+
if (this.enableRenderFrame) {
|
|
3120
|
+
this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
|
|
3121
|
+
}
|
|
3122
|
+
}, this.pixelformate);
|
|
3231
3123
|
}
|
|
3232
3124
|
//----------------------------------//
|
|
3233
3125
|
// Render
|
|
@@ -3256,21 +3148,21 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3256
3148
|
// plugin apis
|
|
3257
3149
|
//----------------------------------//
|
|
3258
3150
|
initPluginManager() {
|
|
3259
|
-
rtcCloud.initializePluginManager();
|
|
3151
|
+
this.rtcCloud.initializePluginManager();
|
|
3260
3152
|
}
|
|
3261
3153
|
destroyPluginManager() {
|
|
3262
|
-
rtcCloud.releasePluginManager();
|
|
3154
|
+
this.rtcCloud.releasePluginManager();
|
|
3263
3155
|
}
|
|
3264
3156
|
addPlugin(plugin) {
|
|
3265
3157
|
// type: 1 表示美颜插件
|
|
3266
3158
|
const pluginType = plugin.type || 1;
|
|
3267
|
-
rtcCloud.registerPlugin(plugin.id, plugin.path, pluginType);
|
|
3159
|
+
this.rtcCloud.registerPlugin(plugin.id, plugin.path, pluginType);
|
|
3268
3160
|
}
|
|
3269
3161
|
removePlugin(id) {
|
|
3270
|
-
rtcCloud.unregisterPlugin(id);
|
|
3162
|
+
this.rtcCloud.unregisterPlugin(id);
|
|
3271
3163
|
}
|
|
3272
3164
|
getPluginList() {
|
|
3273
|
-
return rtcCloud.getPlugins().map((item) => {
|
|
3165
|
+
return this.rtcCloud.getPlugins().map((item) => {
|
|
3274
3166
|
return this.createPlugin(item.id);
|
|
3275
3167
|
});
|
|
3276
3168
|
}
|
|
@@ -3278,22 +3170,29 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3278
3170
|
return {
|
|
3279
3171
|
id: pluginId,
|
|
3280
3172
|
enable: () => {
|
|
3281
|
-
return rtcCloud.enablePlugin(pluginId, true);
|
|
3173
|
+
return this.rtcCloud.enablePlugin(pluginId, true);
|
|
3282
3174
|
},
|
|
3283
3175
|
disable: () => {
|
|
3284
|
-
return rtcCloud.enablePlugin(pluginId, false);
|
|
3176
|
+
return this.rtcCloud.enablePlugin(pluginId, false);
|
|
3285
3177
|
},
|
|
3286
3178
|
setParameter: (param) => {
|
|
3287
|
-
return rtcCloud.setPluginParameter(pluginId, param);
|
|
3179
|
+
return this.rtcCloud.setPluginParameter(pluginId, param);
|
|
3288
3180
|
},
|
|
3289
3181
|
getParameter: () => {
|
|
3290
|
-
return rtcCloud.getPluginParameter(pluginId);
|
|
3182
|
+
return this.rtcCloud.getPluginParameter(pluginId);
|
|
3291
3183
|
}
|
|
3292
3184
|
};
|
|
3293
3185
|
}
|
|
3186
|
+
setPluginCallback(pluginCb) {
|
|
3187
|
+
this.rtcCloud.setPluginCallback(pluginCb);
|
|
3188
|
+
}
|
|
3294
3189
|
getKey(uid, type) {
|
|
3295
3190
|
return String(uid) + '_' + String(type);
|
|
3296
3191
|
}
|
|
3192
|
+
setEnableRenderFrame(enable) {
|
|
3193
|
+
console.log('setEnableRenderFrame:' + enable);
|
|
3194
|
+
this.enableRenderFrame = enable;
|
|
3195
|
+
}
|
|
3297
3196
|
/**
|
|
3298
3197
|
* 判断是否支持webGL
|
|
3299
3198
|
* @returns {boolean}
|
|
@@ -3329,7 +3228,6 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3329
3228
|
return this.streams.get(key);
|
|
3330
3229
|
}
|
|
3331
3230
|
_onRenderFrame(uid, type, width, height, timestamp, rotation, data) {
|
|
3332
|
-
const isCurrentLocalUser = this._isLocalUser(uid);
|
|
3333
3231
|
// 由于 mac 监听自定义渲染回调后不会回调 onFirstVideoFrame ,所以在这里自己实现回调 onFirstVideoFrame
|
|
3334
3232
|
if (this._isMacPlatform()) {
|
|
3335
3233
|
setImmediate(() => {
|
|
@@ -3337,14 +3235,12 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3337
3235
|
return uid === item.uid && type === item.type;
|
|
3338
3236
|
});
|
|
3339
3237
|
if (index === -1) {
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
this.firstVideoFrameList.push({ uid: uid, type: type });
|
|
3343
|
-
}
|
|
3238
|
+
this.emit('onFirstVideoFrame', uid, type, width, height);
|
|
3239
|
+
this.firstVideoFrameList.push({ uid: uid, type: type });
|
|
3344
3240
|
}
|
|
3345
3241
|
});
|
|
3346
3242
|
}
|
|
3347
|
-
if (
|
|
3243
|
+
if (uid.length == 0) {
|
|
3348
3244
|
if (this.isExternalRenderEnabled) {
|
|
3349
3245
|
this.fire(CUSTOM_VIDEO_DATA, {
|
|
3350
3246
|
uid: '', type, rotation, timestamp,
|
|
@@ -3502,7 +3398,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3502
3398
|
});
|
|
3503
3399
|
}
|
|
3504
3400
|
_writeLog(info) {
|
|
3505
|
-
rtcCloud.writeLog(info);
|
|
3401
|
+
this.rtcCloud.writeLog(info);
|
|
3506
3402
|
}
|
|
3507
3403
|
_onUserRenderCallback(callback, format, userid, streamType, width, height, timestamp, rotation, data) {
|
|
3508
3404
|
if (callback !== null) {
|
|
@@ -3585,9 +3481,6 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3585
3481
|
_isMacPlatform() {
|
|
3586
3482
|
return process.platform == 'darwin';
|
|
3587
3483
|
}
|
|
3588
|
-
_isLocalUser(uid) {
|
|
3589
|
-
return uid === '';
|
|
3590
|
-
}
|
|
3591
3484
|
}
|
|
3592
3485
|
class VideoRenderCallback {
|
|
3593
3486
|
constructor() {
|