trtc-electron-sdk 12.1.607 → 12.1.701-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ import { TRTCVideoBufferType, TRTCVideoPixelFormat } from "../../trtc_define";
2
+ declare const NodeTRTCEngine: any;
3
+ export declare class TRTCPlugin {
4
+ private logPrefix;
5
+ private pluginId;
6
+ private device_id;
7
+ private nativeVideoEffectPlugin;
8
+ constructor(pluginId: string, deviceId: string, nativeVideoEffectPlugin: typeof NodeTRTCEngine.NodeRemoteVideoPlugin);
9
+ get deviceId(): string;
10
+ get id(): string;
11
+ enable(flag?: boolean): void;
12
+ /**
13
+ * @deprecated
14
+ */
15
+ disable(): void;
16
+ setParameter(param: string): void;
17
+ }
18
+ export declare class TRTCPluginManager {
19
+ private logPrefix;
20
+ private static pluginManager;
21
+ private nodePluginManager;
22
+ constructor();
23
+ static getInstance(): TRTCPluginManager;
24
+ setVideoPluginFormat(pixelFormat: TRTCVideoPixelFormat, bufferType?: TRTCVideoBufferType): void;
25
+ addPlugin(options: {
26
+ pluginId: string;
27
+ deviceId: string;
28
+ path: string;
29
+ }): TRTCPlugin | null;
30
+ removePlugin(pluginId: string, deviceId: string): void;
31
+ setCallback(callback: (pluginId: string, error: number, errorMessage: string) => void): void;
32
+ }
33
+ export default TRTCPluginManager;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRTCPluginManager = exports.TRTCPlugin = void 0;
4
+ const trtc_define_1 = require("../../trtc_define");
5
+ const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
6
+ const logger = console;
7
+ class TRTCPlugin {
8
+ constructor(pluginId, deviceId, nativeVideoEffectPlugin) {
9
+ this.logPrefix = "[TRTCPlugin]";
10
+ this.pluginId = pluginId;
11
+ this.device_id = deviceId;
12
+ this.nativeVideoEffectPlugin = nativeVideoEffectPlugin;
13
+ }
14
+ get deviceId() {
15
+ return this.device_id;
16
+ }
17
+ get id() {
18
+ return this.pluginId;
19
+ }
20
+ enable(flag = true) {
21
+ logger.debug(`${this.logPrefix}enable:${flag} ${this.pluginId}`);
22
+ this.nativeVideoEffectPlugin.enable(flag);
23
+ }
24
+ /**
25
+ * @deprecated
26
+ */
27
+ disable() {
28
+ this.enable(false);
29
+ }
30
+ setParameter(param) {
31
+ logger.debug(`${this.logPrefix}setParameter:${this.pluginId}`);
32
+ this.nativeVideoEffectPlugin.setParameter(param);
33
+ }
34
+ }
35
+ exports.TRTCPlugin = TRTCPlugin;
36
+ class TRTCPluginManager {
37
+ constructor() {
38
+ this.logPrefix = '[TRTCPluginManager]';
39
+ if (!TRTCPluginManager.pluginManager) {
40
+ this.nodePluginManager = new NodeTRTCEngine.NodeRemoteVideoPluginManager();
41
+ TRTCPluginManager.pluginManager = this;
42
+ }
43
+ else {
44
+ return TRTCPluginManager.pluginManager;
45
+ }
46
+ }
47
+ static getInstance() {
48
+ if (!TRTCPluginManager.pluginManager) {
49
+ TRTCPluginManager.pluginManager = new TRTCPluginManager();
50
+ }
51
+ return TRTCPluginManager.pluginManager;
52
+ }
53
+ setVideoPluginFormat(pixelFormat, bufferType = trtc_define_1.TRTCVideoBufferType.TRTCVideoBufferType_Buffer) {
54
+ logger.debug(`${this.logPrefix}setVideoPluginFormat bufferType:${bufferType} pixelFormat:${pixelFormat}`);
55
+ this.nodePluginManager.setVideoPluginFormat(bufferType, pixelFormat);
56
+ }
57
+ addPlugin(options) {
58
+ logger.debug(`${this.logPrefix}addVideoPlugin pluginId:${options.pluginId} deviceId:${options.deviceId} path:${options.path}`);
59
+ const nativeVideoEffectPlugin = this.nodePluginManager.addVideoPlugin(options.deviceId, options.pluginId, options.path);
60
+ if (nativeVideoEffectPlugin) {
61
+ return new TRTCPlugin(options.pluginId, options.deviceId, nativeVideoEffectPlugin);
62
+ }
63
+ else {
64
+ return null;
65
+ }
66
+ }
67
+ removePlugin(pluginId, deviceId) {
68
+ logger.debug(`${this.logPrefix}removeVideoPlugin pluginId:${pluginId} deviceId:${deviceId}`);
69
+ this.nodePluginManager.removeVideoPlugin(deviceId, pluginId);
70
+ }
71
+ setCallback(callback) {
72
+ this.nodePluginManager.setCallback(callback);
73
+ }
74
+ }
75
+ exports.TRTCPluginManager = TRTCPluginManager;
76
+ exports.default = TRTCPluginManager;
package/liteav/trtc.d.ts CHANGED
@@ -1,10 +1,18 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
3
  import { TRTCConfig } from './Renderer/util';
4
- import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSpeedTestResult, TRTCStatistics, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCAudioFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCVolumeInfo, TRTCWaterMarkSrcType, TRTCQualityInfo, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions } from './trtc_define';
4
+ import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSpeedTestResult, TRTCStatistics, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCAudioFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCVolumeInfo, TRTCWaterMarkSrcType, TRTCQualityInfo, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCVoiceChangerType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions, TRTCUseCase } from './trtc_define';
5
+ import TRTCDeviceManager from './extensions/DeviceManager';
6
+ import TRTCAudioEffectManager from './extensions/AudioEffectManager';
7
+ import TRTCMediaMixingManager from './extensions/MediaMixingManager';
8
+ import TRTCPluginManager from './extensions/PluginManager';
5
9
  export * from './trtc_define';
6
10
  export * from './trtc_code';
7
11
  export * from './vod_player';
12
+ export * from './extensions/DeviceManager';
13
+ export * from './extensions/AudioEffectManager';
14
+ export * from './extensions/MediaMixingManager';
15
+ export * from './extensions/PluginManager';
8
16
  /**
9
17
  * 腾讯云视频通话功能的主要接口类
10
18
  *
@@ -20,6 +28,7 @@ export * from './vod_player';
20
28
  declare class TRTCCloud extends EventEmitter {
21
29
  private logger;
22
30
  private id;
31
+ private static useCase;
23
32
  private static sharedTRTCCloudInstance;
24
33
  private static subInstances;
25
34
  private rtcCloud;
@@ -56,6 +65,14 @@ declare class TRTCCloud extends EventEmitter {
56
65
  private remoteVideoBufferMap;
57
66
  private localVideoBufferMap;
58
67
  constructor(config?: TRTCInitConfig);
68
+ /**
69
+ * 设置 SDK 使用场景
70
+ *
71
+ * 注意:必须在调用 TRTCCloud.getTRTCShareInstance() 接口,获取 TRTC 实例前调用才能生效。
72
+ *
73
+ * @param useCase {TRTCUseCase} - SDK 使用场景
74
+ */
75
+ static setUseCase(useCase: TRTCUseCase): void;
59
76
  /**
60
77
  * 创建 TRTCCloud 主实例对象(单例模式)
61
78
  * @returns {TRTCCloud}
@@ -2555,6 +2572,7 @@ declare class TRTCCloud extends EventEmitter {
2555
2572
  getPluginList(): TRTCPluginInfo[];
2556
2573
  private _getKey;
2557
2574
  setEnableRenderFrame(enable: boolean): void;
2575
+ log(info: string): void;
2558
2576
  private _getRendererMap;
2559
2577
  private _onRenderFrame;
2560
2578
  private _onRealRender;
@@ -2580,6 +2598,10 @@ declare class TRTCCloud extends EventEmitter {
2580
2598
  private _RGBA2BGRA;
2581
2599
  private _isMacPlatform;
2582
2600
  private _setRemoteVideoBuffer;
2601
+ getDeviceManager(): TRTCDeviceManager;
2602
+ getAudioEffectManager(): TRTCAudioEffectManager;
2603
+ getMediaMixingManager(): TRTCMediaMixingManager;
2604
+ getPluginManager(): TRTCPluginManager;
2583
2605
  }
2584
2606
  export default TRTCCloud;
2585
2607
  export * from './LocalMediaTranscoder';
package/liteav/trtc.js CHANGED
@@ -37,11 +37,19 @@ const validate_util_1 = require("./validate-util");
37
37
  const logger_1 = __importStar(require("./logger"));
38
38
  const LocalVideoRenderController_1 = __importDefault(require("./VideoRenderControl/LocalVideoRenderController"));
39
39
  const VideoRenderFPSMonitor_1 = require("./VideoRenderControl/VideoRenderFPSMonitor");
40
+ const DeviceManager_1 = __importDefault(require("./extensions/DeviceManager"));
41
+ const AudioEffectManager_1 = __importDefault(require("./extensions/AudioEffectManager"));
42
+ const MediaMixingManager_1 = __importDefault(require("./extensions/MediaMixingManager"));
43
+ const PluginManager_1 = __importDefault(require("./extensions/PluginManager"));
40
44
  const NodeTRTCEngine = require('../build/Release/trtc_electron_sdk.node');
41
45
  const pkg = require('../package.json');
42
46
  __exportStar(require("./trtc_define"), exports);
43
47
  __exportStar(require("./trtc_code"), exports);
44
48
  __exportStar(require("./vod_player"), exports);
49
+ __exportStar(require("./extensions/DeviceManager"), exports);
50
+ __exportStar(require("./extensions/AudioEffectManager"), exports);
51
+ __exportStar(require("./extensions/MediaMixingManager"), exports);
52
+ __exportStar(require("./extensions/PluginManager"), exports);
45
53
  // 监听该事件,返回自定义视频渲染数据 ( bgra 格式)
46
54
  const CUSTOM_VIDEO_DATA = 'onVideoData';
47
55
  const LOCAL_VIDEO_DATA = 'onLocalVideoData';
@@ -160,7 +168,13 @@ class TRTCCloud extends events_1.EventEmitter {
160
168
  this.id = !TRTCCloud.sharedTRTCCloudInstance ? 1 : (2 + (((_a = TRTCCloud.subInstances) === null || _a === void 0 ? void 0 : _a.length) || 0));
161
169
  this.logger = new logger_1.Logger(`TRTC_${this.id}`);
162
170
  const componentNO = getComponentNO();
163
- this.rtcCloud = new NodeTRTCEngine.NodeTRTCCloud(Object.assign({ jsVersion: pkg.version, componentNO }, config));
171
+ const newConfig = Object.assign({ jsVersion: pkg.version, componentNO }, config);
172
+ if (TRTCCloud.useCase === trtc_define_1.TRTCUseCase.TRTC_NORMAL) {
173
+ this.rtcCloud = new NodeTRTCEngine.NodeTRTCCloud(newConfig);
174
+ }
175
+ else {
176
+ this.rtcCloud = new NodeTRTCEngine.NodeRemoteTRTCCloud(newConfig);
177
+ }
164
178
  this.videoRendererMap = new Map();
165
179
  this.pixelFormat = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
166
180
  this.pixelLength = 1.5;
@@ -222,6 +236,34 @@ class TRTCCloud extends events_1.EventEmitter {
222
236
  TRTCCloud.subInstances.push(this);
223
237
  }
224
238
  }
239
+ /**
240
+ * 设置 SDK 使用场景
241
+ *
242
+ * 注意:必须在调用 TRTCCloud.getTRTCShareInstance() 接口,获取 TRTC 实例前调用才能生效。
243
+ *
244
+ * @param useCase {TRTCUseCase} - SDK 使用场景
245
+ */
246
+ static setUseCase(useCase) {
247
+ var _a;
248
+ logger_1.default.warn(`TRTC set use case to:${useCase}`);
249
+ if (TRTCCloud.sharedTRTCCloudInstance || ((_a = TRTCCloud.subInstances) === null || _a === void 0 ? void 0 : _a.length) >= 1) {
250
+ const message = "Already create TRTCCloud instance, cannot invoke 'setUseCase' method";
251
+ logger_1.default.log(message);
252
+ throw new Error(message);
253
+ }
254
+ if (useCase === trtc_define_1.TRTCUseCase.TRTC_ULTRA_LIVE) {
255
+ TRTCCloud.useCase = useCase;
256
+ NodeTRTCEngine.setRemoteTrtcWithAcrossProcessMode(true);
257
+ }
258
+ else if (TRTCCloud.useCase !== trtc_define_1.TRTCUseCase.TRTC_NORMAL) {
259
+ TRTCCloud.useCase = trtc_define_1.TRTCUseCase.TRTC_NORMAL;
260
+ NodeTRTCEngine.setRemoteTrtcWithAcrossProcessMode(false);
261
+ }
262
+ else {
263
+ // nothing to do
264
+ }
265
+ logger_1.default.log(`TRTC use case:${TRTCCloud.useCase}`);
266
+ }
225
267
  /**
226
268
  * 创建 TRTCCloud 主实例对象(单例模式)
227
269
  * @returns {TRTCCloud}
@@ -245,7 +287,9 @@ class TRTCCloud extends events_1.EventEmitter {
245
287
  }
246
288
  onFPSChanged(options) {
247
289
  this.videoRenderFPS = options.videoFPS !== -1 ? options.videoFPS : 60;
248
- this.rtcCloud.setVideoRenderFPS(this.videoRenderFPS);
290
+ if (TRTCCloud.useCase === trtc_define_1.TRTCUseCase.TRTC_NORMAL) {
291
+ this.rtcCloud.setVideoRenderFPS(this.videoRenderFPS);
292
+ }
249
293
  }
250
294
  /**
251
295
  * 创建子实例
@@ -319,6 +363,7 @@ class TRTCCloud extends events_1.EventEmitter {
319
363
  VideoRenderFPSMonitor_1.videoRenderFPSMonitor.off('videoRenderFPS', this.onFPSChanged);
320
364
  this.playAudioEffectIdList = [];
321
365
  this.remoteFillModeMap.clear();
366
+ // this.destroyLocalMediaTranscoder();
322
367
  this.rtcCloud.destroy();
323
368
  this.rtcCloud = null;
324
369
  }
@@ -4453,6 +4498,22 @@ class TRTCCloud extends events_1.EventEmitter {
4453
4498
  //----------------------------------//
4454
4499
  // Vod API -- start
4455
4500
  //----------------------------------//
4501
+ // createVodPlayer(mediaFilePath: string, repeat: boolean) {
4502
+ // const nativeVodPlayer = this.rtcCloud.createVodPlayer(mediaFilePath, repeat);
4503
+ // if (nativeVodPlayer) {
4504
+ // const vodPlayer = new VodPlayer(nativeVodPlayer, mediaFilePath, repeat);
4505
+ // vodPlayer.setVodPlayerRenderCallback();
4506
+ // vodPlayer.setVodEventCallback();
4507
+ // this.vodPlayers[vodPlayer.key] = vodPlayer;
4508
+ // return vodPlayer;
4509
+ // }
4510
+ // return null;
4511
+ // }
4512
+ // destroyVodPlayer(vodPlayer: VodPlayer) {
4513
+ // vodPlayer.destroyRender();
4514
+ // this.rtcCloud.destroyVodPlayer(vodPlayer.key);
4515
+ // delete this.vodPlayers[vodPlayer.key];
4516
+ // }
4456
4517
  //----------------------------------//
4457
4518
  // Vod API -- end
4458
4519
  //----------------------------------//
@@ -4463,6 +4524,9 @@ class TRTCCloud extends events_1.EventEmitter {
4463
4524
  this.logger.debug('setEnableRenderFrame:' + enable);
4464
4525
  this.enableRenderFrame = enable;
4465
4526
  }
4527
+ log(info) {
4528
+ this.rtcCloud.log(info);
4529
+ }
4466
4530
  _getRendererMap(uid, streamType) {
4467
4531
  const key = this._getKey(uid, streamType);
4468
4532
  return this.videoRendererMap.get(key);
@@ -4858,7 +4922,67 @@ class TRTCCloud extends events_1.EventEmitter {
4858
4922
  }
4859
4923
  videoBufferInfo.buffer && this.rtcCloud.setRemoteVideoBuffer(userId, videoBufferInfo.buffer, videoBufferInfo.streamType, videoBufferInfo.width, videoBufferInfo.height, videoBufferInfo.pixelFormat, videoBufferInfo.id);
4860
4924
  }
4925
+ // //-------------------------------------------------//
4926
+ // // Local media transcoding API begin
4927
+ // //-------------------------------------------------//
4928
+ // /**
4929
+ // * 创建本地多媒体合图实例
4930
+ // *
4931
+ // * 注意:单例模式,多次调用返回的是同一个对象
4932
+ // *
4933
+ // * @param {Object} config - 配置参数
4934
+ // * @param {TRTCVideoPixelFormat} config.pixelFormat - 视频数据的像素格式
4935
+ // * @returns {TRTCLocalMediaTranscoder}
4936
+ // */
4937
+ // createLocalMediaTranscoder(config?: {
4938
+ // pixelFormat: TRTCVideoPixelFormat
4939
+ // }): TRTCLocalMediaTranscoder | null {
4940
+ // if (this.localMediaTranscoder === null) {
4941
+ // let pixelFormat = TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
4942
+ // if (config && config.pixelFormat) {
4943
+ // pixelFormat = config.pixelFormat;
4944
+ // }
4945
+ // const nativeLocalMediaTranscoding = this.rtcCloud.createLocalMediaTranscoding();
4946
+ // if (nativeLocalMediaTranscoding) {
4947
+ // this.localMediaTranscoder = new TRTCLocalMediaTranscoder(nativeLocalMediaTranscoding, pixelFormat);
4948
+ // } else {
4949
+ // console.warn('TRTCLocalMediaTranscoder create error. Currently only support "Windows" operation system.')
4950
+ // }
4951
+ // }
4952
+ // return this.localMediaTranscoder;
4953
+ // }
4954
+ // /**
4955
+ // * 销毁本地多媒体合图实例
4956
+ // */
4957
+ // destroyLocalMediaTranscoder(): void {
4958
+ // if (this.localMediaTranscoder) {
4959
+ // try {
4960
+ // this.localMediaTranscoder.destroy();
4961
+ // this.localMediaTranscoder = null;
4962
+ // this.rtcCloud.destroyLocalMediaTranscoding();
4963
+ // } catch (e: any) {
4964
+ // // 重复销毁会有报错提示
4965
+ // console.warn(`trtc:destroyLocalMediaTranscoder warning:`, e.message);
4966
+ // }
4967
+ // }
4968
+ // }
4969
+ // //-------------------------------------------------//
4970
+ // // Local media transocoding API end
4971
+ // //-------------------------------------------------//
4972
+ getDeviceManager() {
4973
+ return DeviceManager_1.default.getInstance();
4974
+ }
4975
+ getAudioEffectManager() {
4976
+ return AudioEffectManager_1.default.getInstance();
4977
+ }
4978
+ getMediaMixingManager() {
4979
+ return MediaMixingManager_1.default.getInstance();
4980
+ }
4981
+ getPluginManager() {
4982
+ return PluginManager_1.default.getInstance();
4983
+ }
4861
4984
  }
4985
+ TRTCCloud.useCase = trtc_define_1.TRTCUseCase.TRTC_NORMAL;
4862
4986
  class VideoRenderCallback {
4863
4987
  constructor() {
4864
4988
  this.callback = null;
@@ -86,6 +86,13 @@ export declare type TRTCAudioParallelParams = {
86
86
  maxCount: number;
87
87
  includeUsers: Array<string>;
88
88
  };
89
+ /**
90
+ * 使用场景
91
+ */
92
+ export declare enum TRTCUseCase {
93
+ TRTC_NORMAL = 0,
94
+ TRTC_ULTRA_LIVE = 1
95
+ }
89
96
  export declare enum TRTCAppScene {
90
97
  TRTCAppSceneVideoCall = 0,
91
98
  TRTCAppSceneLIVE = 1,
@@ -265,10 +272,11 @@ export declare enum TRTCLogLevel {
265
272
  export declare enum TRTCDeviceState {
266
273
  TRTCDeviceStateAdd = 0,
267
274
  TRTCDeviceStateRemove = 1,
268
- TRTCDeviceStateActive = 2
275
+ TRTCDeviceStateActive = 2,
276
+ TRTCDefaultDeviceChanged = 3
269
277
  }
270
278
  export declare enum TRTCDeviceType {
271
- TRTCDeviceTypeUnknow = -1,
279
+ TRTCDeviceTypeUnknown = -1,
272
280
  TRTCDeviceTypeMic = 0,
273
281
  TRTCDeviceTypeSpeaker = 1,
274
282
  TRTCDeviceTypeCamera = 2
@@ -512,6 +520,7 @@ export declare class TRTCSpeedTestResult {
512
520
  /**
513
521
  * 记录矩形的四个点坐标
514
522
  *
523
+ * @deprecated
515
524
  * @param {Number} left - 左坐标
516
525
  * @param {Number} top - 上坐标
517
526
  * @param {Number} right - 右坐标
@@ -525,6 +534,21 @@ export declare class Rect {
525
534
  bottom: number;
526
535
  constructor(left?: number, top?: number, right?: number, bottom?: number);
527
536
  }
537
+ /**
538
+ * 矩形区域
539
+ *
540
+ * 矩形坐标区域
541
+ */
542
+ export declare type TRTCRect = {
543
+ /** 左边线坐标 */
544
+ left: number;
545
+ /** 顶边线坐标 */
546
+ top: number;
547
+ /** 右边线坐标 */
548
+ right: number;
549
+ /** 底边线坐标 */
550
+ bottom: number;
551
+ };
528
552
  /**
529
553
  * 云端混流中每一路子画面的位置信息
530
554
  *
@@ -836,15 +860,22 @@ export declare class TRTCRemoteStatistics {
836
860
  * 而 30% 的丢包率则意味着服务器向 SDK 发送的每10个数据包中就会有3个会在下行传输中丢失。
837
861
  * @param {Number} appCpu - 当前 App 的 CPU 使用率(%)
838
862
  * @param {Number} systemCpu - 当前系统的 CPU 使用率(%)
839
- * @param {Number} rtt - 延迟(毫秒),代表 SDK 跟服务器一来一回之间所消耗的时间,这个值越小越好。
840
- * 一般低于50ms的 rtt 是比较理想的情况,而高于100ms的 rtt 会引入较大的通话延时。
841
- * 由于数据上下行共享一条网络连接,所以 local remote rtt 相同。
863
+ * @param {Number} rtt - SDK 到云端的往返延时,单位 ms。
864
+ * 该数值代表从 SDK 发送一个网络包到云端,再从云端回送一个网络包到 SDK 的总计耗时,也就是一个网络包经历 “SDK=>云端=>SDK” 的总耗时。
865
+ * 该数值越小越好:如果 rtt < 50ms,意味着较低的音视频通话延迟;如果 rtt > 200ms,则意味着较高的音视频通话延迟。
866
+ * 需要特别解释的是,rtt 代表 “SDK=>云端=>SDK” 的总耗时,所以不需要区分 upRtt 和 downRtt。
842
867
  * @param {Number} receivedBytes - 总接收字节数(包含信令和音视频)
843
868
  * @param {Number} sentBytes - 总发送字节总数(包含信令和音视频)
844
869
  * @param {TRTCLocalStatistics[]} localStatisticsArray - 自己本地的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
845
870
  * @param {Number} localStatisticsArraySize - 数组 localStatisticsArray 的大小
846
871
  * @param {TRTCRemoteStatistics[]} remoteStatisticsArray - 远端成员的音视频统计信息,由于可能有大画面、小画面以及辅路画面等多路的情况,所以是一个数组
847
872
  * @param {Number} remoteStatisticsArraySize - 数组 remoteStatisticsArray 的大小
873
+ * @param {Number} gatewayRtt - 从 SDK 到本地路由器的往返时延,单位 ms。
874
+ * 该数值代表从 SDK 发送一个网络包到本地路由器网关,再从网关回送一个网络包到 SDK 的总计耗时,也就是一个网络包经历 “SDK>网关>SDK” 的总耗时。
875
+ * 该数值越小越好:如果 gatewayRtt < 50ms,意味着较低的音视频通话延迟;如果 gatewayRtt > 200ms,则意味着较高的音视频通话延迟。
876
+ * @param {Number} systemMemoryInMB - 当前系统的内存,单位 (MB)
877
+ * @param {Number} systemMemoryUsageInMB - 当前系统内存占用,单位 (MB)
878
+ * @param {Number} appMemoryUsageInMB - 当前应用的内存占用,单位 (MB)
848
879
  *
849
880
  */
850
881
  export declare class TRTCStatistics {
@@ -859,7 +890,11 @@ export declare class TRTCStatistics {
859
890
  localStatisticsArraySize: number;
860
891
  remoteStatisticsArray: TRTCRemoteStatistics[];
861
892
  remoteStatisticsArraySize: number;
862
- constructor(upLoss?: number, downLoss?: number, appCpu?: number, systemCpu?: number, rtt?: number, receivedBytes?: number, sentBytes?: number, localStatisticsArray?: TRTCLocalStatistics[], localStatisticsArraySize?: number, remoteStatisticsArray?: TRTCRemoteStatistics[], remoteStatisticsArraySize?: number);
893
+ gatewayRtt: number;
894
+ appMemoryUsageInMB: number;
895
+ systemMemoryUsageInMB: number;
896
+ systemMemoryInMB: number;
897
+ constructor(upLoss?: number, downLoss?: number, appCpu?: number, systemCpu?: number, rtt?: number, receivedBytes?: number, sentBytes?: number, localStatisticsArray?: TRTCLocalStatistics[], localStatisticsArraySize?: number, remoteStatisticsArray?: TRTCRemoteStatistics[], remoteStatisticsArraySize?: number, gatewayRtt?: number, appMemoryUsageInMB?: number, systemMemoryUsageInMB?: number, systemMemoryInMB?: number);
863
898
  }
864
899
  /**
865
900
  * 音乐参数
@@ -883,6 +918,15 @@ export declare class AudioMusicParam {
883
918
  endTimeMS: number;
884
919
  constructor(id?: number, path?: string, loopCount?: number, publish?: boolean, isShortFile?: boolean, startTimeMS?: number, endTimeMS?: number);
885
920
  }
921
+ export declare type TRTCAudioMusicParam = {
922
+ id: number;
923
+ path: string;
924
+ loopCount: number;
925
+ publish: boolean;
926
+ isShortFile: boolean;
927
+ startTimeMS: number;
928
+ endTimeMS: number;
929
+ };
886
930
  /**
887
931
  * 背景音乐播放事件监听器类型定义
888
932
  */