trtc-sdk-v5 5.2.0-beta.8 → 5.2.0-beta.9
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/index.d.ts +95 -1
- package/package.json +1 -1
- package/trtc.esm.js +23 -23
- package/trtc.js +1 -1
package/index.d.ts
CHANGED
|
@@ -301,7 +301,85 @@
|
|
|
301
301
|
'AIDenoiser': undefined;
|
|
302
302
|
'CDNStreaming': CDNStreamingOptions;
|
|
303
303
|
};
|
|
304
|
+
declare interface TRTCStatistics {
|
|
305
|
+
rtt: number;
|
|
306
|
+
downLoss: number;
|
|
307
|
+
upLoss: number;
|
|
308
|
+
bytesSent: number;
|
|
309
|
+
bytesReceived: number;
|
|
310
|
+
localStatistics: LocalStatistic;
|
|
311
|
+
remoteStatistics: RemoteStatistic[];
|
|
312
|
+
}
|
|
313
|
+
interface LocalStatistic {
|
|
314
|
+
audio: {
|
|
315
|
+
bitrate: number;
|
|
316
|
+
audioLevel: number;
|
|
317
|
+
};
|
|
318
|
+
video: {
|
|
319
|
+
width: number;
|
|
320
|
+
height: number;
|
|
321
|
+
frameRate: number;
|
|
322
|
+
bitrate: number;
|
|
323
|
+
videoType: TRTCVideoType;
|
|
324
|
+
}[];
|
|
325
|
+
}
|
|
326
|
+
declare enum TRTCVideoType {
|
|
327
|
+
Big = "big",
|
|
328
|
+
Small = "small",
|
|
329
|
+
Sub = "sub"
|
|
330
|
+
}
|
|
331
|
+
interface RemoteStatistic {
|
|
332
|
+
audio: {
|
|
333
|
+
bitrate: number;
|
|
334
|
+
audioLevel: number;
|
|
335
|
+
};
|
|
336
|
+
video: {
|
|
337
|
+
width: number;
|
|
338
|
+
height: number;
|
|
339
|
+
frameRate: number;
|
|
340
|
+
bitrate: number;
|
|
341
|
+
videoType: TRTCVideoType;
|
|
342
|
+
}[];
|
|
343
|
+
userId: string;
|
|
344
|
+
}
|
|
304
345
|
|
|
346
|
+
/**
|
|
347
|
+
* @typedef TRTCStatistics TRTC 通话统计信息
|
|
348
|
+
* @property {number} rtt 从 SDK 与 云端的往返延时(一个网络包经历 “SDK -> 云端 -> SDK” 的总耗时),单位 ms。
|
|
349
|
+
* @property {number} upLoss 从 SDK 到云端的上行丢包率,单位 (%)
|
|
350
|
+
* @property {number} downLoss 从云端到 SDK 的下行丢包率,单位 (%)
|
|
351
|
+
* @property {number} bytesSent 总发送字节数(包含信令数据和音视频数据),单位:字节数(Bytes)。
|
|
352
|
+
* @property {number} bytesReceived 总接收字节数(包含信令数据和音视频数据),单位:字节数(Bytes)。
|
|
353
|
+
* @property {TRTCLocalStatistics} localStatistics 本地的音视频统计信息
|
|
354
|
+
* @property {TRTCRemoteStatistics[]} remoteStatistics 远端的音视频统计信息
|
|
355
|
+
*/
|
|
356
|
+
/**
|
|
357
|
+
* 本地的音视频统计信息
|
|
358
|
+
* @typedef TRTCLocalStatistics
|
|
359
|
+
* @property {TRTCAudioStatistic} audio 本地音频统计信息
|
|
360
|
+
* @property {TRTCVideoStatistic[]} video 本地视频统计信息
|
|
361
|
+
*/
|
|
362
|
+
/**
|
|
363
|
+
* 远端的音视频统计信息
|
|
364
|
+
* @typedef TRTCRemoteStatistics
|
|
365
|
+
* @property {string} userId 远端用户的 userId
|
|
366
|
+
* @property {TRTCAudioStatistic} audio 远端音频统计信息
|
|
367
|
+
* @property {TRTCVideoStatistic[]} video 远端视频统计信息
|
|
368
|
+
*/
|
|
369
|
+
/**
|
|
370
|
+
* 音频统计信息
|
|
371
|
+
* @typedef TRTCAudioStatistic
|
|
372
|
+
* @property {number} bitrate 音频码率,单位:Kbps
|
|
373
|
+
* @property {number} audioLevel 音量大小,0 ~ 1 的浮点数。
|
|
374
|
+
*/
|
|
375
|
+
/** 视频统计信息
|
|
376
|
+
* @typedef TRTCVideoStatistic
|
|
377
|
+
* @property {number} bitrate 视频码率,单位:Kbps
|
|
378
|
+
* @property {number} width 视频宽度
|
|
379
|
+
* @property {number} height 视频高度
|
|
380
|
+
* @property {number} frameRate 视频帧率
|
|
381
|
+
* @property {'big'|'small'|'sub'} videoType 视频类型,大流、小流、辅流。
|
|
382
|
+
*/
|
|
305
383
|
/**
|
|
306
384
|
* **TRTC事件列表**<br>
|
|
307
385
|
* <br>
|
|
@@ -339,7 +417,7 @@
|
|
|
339
417
|
* @example
|
|
340
418
|
* trtc.on(TRTC.EVENT.AUTOPLAY_FAILED, event => {
|
|
341
419
|
* // 引导用户点击页面,当用户点击页面时,SDK 会自动恢复播放。
|
|
342
|
-
* // v5.1.3+
|
|
420
|
+
* // 自 v5.1.3+ 新增 userId 参数,表示哪个用户出现自动播放失败。
|
|
343
421
|
* console.log(event.userId);
|
|
344
422
|
* });
|
|
345
423
|
*/
|
|
@@ -652,6 +730,20 @@
|
|
|
652
730
|
* })
|
|
653
731
|
*/
|
|
654
732
|
readonly SEI_MESSAGE: "sei-message";
|
|
733
|
+
/**
|
|
734
|
+
* @description 通话相关数据指标。<br>
|
|
735
|
+
*
|
|
736
|
+
* - 监听该事件后,SDK 会以 2s 一次的频率定时抛出该事件。
|
|
737
|
+
* - 您可以从该事件中可以获取通话的网络质量(rtt、丢包率)、上行和下行的音视频统计信息(音量大小、宽高、帧率、码率)等信息。详细参数说明请参考:{@link TRTCStatistics}
|
|
738
|
+
* @default 'statistics'
|
|
739
|
+
* @since v5.2.0
|
|
740
|
+
* @memberof module:EVENT
|
|
741
|
+
* @example
|
|
742
|
+
* trtc.on(TRTC.EVENT.STATISTICS, statistics => {
|
|
743
|
+
* console.warn(statistics.rtt, statistics.upLoss, statistics.downLoss);
|
|
744
|
+
* })
|
|
745
|
+
*/
|
|
746
|
+
readonly STATISTICS: "statistics";
|
|
655
747
|
};
|
|
656
748
|
declare interface TRTCEventTypes {
|
|
657
749
|
[TRTCEvent.ERROR]: [RtcError];
|
|
@@ -722,6 +814,7 @@
|
|
|
722
814
|
data: Uint8Array;
|
|
723
815
|
userId: string;
|
|
724
816
|
}];
|
|
817
|
+
[TRTCEvent.STATISTICS]: [statistics: TRTCStatistics];
|
|
725
818
|
}
|
|
726
819
|
class TRTC extends EventEmitter<TRTCEventTypes> {
|
|
727
820
|
/**
|
|
@@ -1408,6 +1501,7 @@
|
|
|
1408
1501
|
readonly DEVICE_CHANGED: "device-changed";
|
|
1409
1502
|
readonly PUBLISH_STATE_CHANGED: "publish-state-changed";
|
|
1410
1503
|
readonly SEI_MESSAGE: "sei-message";
|
|
1504
|
+
readonly STATISTICS: "statistics";
|
|
1411
1505
|
};
|
|
1412
1506
|
static ERROR_CODE: {
|
|
1413
1507
|
INVALID_PARAMETER: number;
|