在特定应用场景下,开发者需要获取网络及参会者音视频数据以支持数据分析或显示。通过SDK提供的统计接口,您可以获取:
调用 getStatistics 方法获取通话中的详细数据。
interface NetworkInfo {
rtt: number; // 往返时延(ms)
rxDetectBw: number; // 接收带宽(kbps)
rxJitter: number; // 接收抖动(ms)
rxLost: number; // 接收丢包率(%)
txDetectBw: number; // 发送带宽(kbps)
txJitter: number; // 发送抖动(ms)
txLost: number; // 发送丢包率(%)
}
interface MediaInfo {
codecType: string; // 编解码类型
disName: string; // 显示名称
actBw: number; // 实际带宽
resolution?: string; // 分辨率(视频)
frameRate?: number; // 帧率(视频)
}
interface EncryptType {
cAEncrypt: string; // Content音频加密类型
cVEncrypt: string; // Content视频加密类型
pAEncrypt: string; // People音频加密类型
pVEncrypt: string; // People视频加密类型
}
/**
* 获取并设置网络质量数据
*/
setNetWorkStatistics() {
const instance = XYRTCEngine.getInstance();
const statistics = instance.getStatistics();
console.log("========statistics", JSON.stringify(statistics));
// 更新网络信息
this.xyCallTooBarModel.network = statistics.network;
// 更新参会者音视频信息
this.xyCallTooBarModel.peopleStatistics = {
audioRxInfo: statistics.people.audioRxInfo,
audioTxInfo: statistics.people.audioTxInfo,
videoRxInfo: statistics.people.videoRxInfo,
videoTxInfo: statistics.people.videoTxInfo
};
// 更新内容共享音视频信息
this.xyCallTooBarModel.contentStatistics = {
audioRxInfo: statistics.content.audioRxInfo,
audioTxInfo: statistics.content.audioTxInfo,
videoRxInfo: statistics.content.videoRxInfo,
videoTxInfo: statistics.content.videoTxInfo
};
}