Quality | Name | Description |
0 | Unknown | Unperceived |
1 | Excellent | The present network is exceedingly good |
2 | Good | The current network is fairly good |
3 | Poor | Current network is average |
4 | Bad | Present network quality is poor, it might cause noticeable stutters and communication delays |
5 | VeryBad | The current network conditions are abysmal, TRTC can barely maintain a connection, yet it can't guarantee the quality of communication |
6 | Down | The current network does not meet the minimum requirements of TRTC, obstructing the normal audio and video conversation |
// Monitor the onNetworkQuality callback and perceive the alterations in the current network statusif (type == TRTCCloudListener.onNetworkQuality) {if (type == TRTCCloudDef.TRTC_QUALITY_UNKNOWN) {// TODO} else if (type == TRTCCloudDef.TRTC_QUALITY_Excellent) {// TODO} else if (type == TRTCCloudDef.TRTC_QUALITY_Good) {// TODO} else if (type == TRTCCloudDef.TRTC_QUALITY_Poor) {// TODO} else if (type == TRTCCloudDef.TRTC_QUALITY_Bad) {// TODO} else if (type == TRTCCloudDef.TRTC_QUALITY_Vbad) {// TODO} else if (type == TRTCCloudDef.TRTC_QUALITY_Down) {// TODO}// Get the network quality of remote usersfor (var info in param['remoteQuality']) {// TODO}}
Field | Meaning | Description |
success | Whether it is successful | Whether this test was successful |
errMsg | Error message | Detailed error information of bandwidth testing |
ip | Server address | Testing server IP |
quality | Network quality score | Network quality measured by the evaluation algorithm. The lower the loss, the smaller the RTT, and the higher the score |
upLostRate | Upstream packet loss rate | The range is [0 - 1.0], for example, 0.3 means that out of 10 data packets sent to the server, 3 may be lost midway |
downLostRate | Downstream packet loss rate | The range is [0 - 1.0], for example, 0.2 means that out of every 10 data packets received from the server, 2 may be lost |
rtt | Latency | Represents the time consumed in the round trip between the SDK and the server. The smaller the value, the better. The normal range is between 10ms and 100ms |
availableUpBandwidth | Upstream bandwidth | Predicted upstream bandwidth, in kbps. -1 indicates an invalid value |
availableDownBandwidth | Downstream bandwidth | Predicted downstream bandwidth, in kbps. -1 indicates an invalid value |
startSpeedTest
method of TRTCCloud (in Flutter, use the startSpeedTestWithParams
interface). The speed test results will be returned via a callback function.// Sample code to start network speed test. Requires sdkAppId and UserSig (refer to the basic feature for how to obtain these)// This is an example starting from log in to begin testing_onLogin(String userId, String userSig) async {TRTCSpeedTestParams params = TRTCSpeedTestParams(// sdkAppID is the actual app's AppID obtained from the consolesdkAppId: sdkAppId,userId: userId,userSig: userSig,scene: TRTCSpeedTestScene.delayBandwidthTesting,// Expected upstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to testexpectedDownBandwidth: 500,// Expected downstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to testexpectedUpBandwidth: 500,);int? returnValue = await trtcCloud.startSpeedTestWithParams(params);trtcCloud.registerListener(speedTestListener);}speedTestListener(type, param) {if (type == TRTCCloudListener.onSpeedTestResult) {var result = param['result']; bool success = result['success']; String errMsg = result['errMsg']; String ip = result['ip']; int quality = result['quality']; double upLostRate = result['upLostRate']; double downLostRate = result['downLostRate']; int rtt = result['rtt']; int availableDownBandwidth = result['availableDownBandwidth']; int availableUpBandwidth = result['availableUpBandwidth']; int upJitter = result['upJitter']; int downJitter = result['downJitter'];}}
Was this page helpful?