please select
RTC Engine
  • Overview
  • Web
    • Run Sample Demo
    • Integration
    • Basic Features
      • Screen Sharing
      • Live Streaming
      • Media Device
      • Audio Volume
      • Set Encoding Profile
      • Detect Network Quality
      • Detect Capabilities
    • Advance Features
      • Enable AI Denoiser
      • Enable Audio Mixer
      • Enable Watermark
      • Enable Virtual Background
      • Enable Beauty and Effects
      • Data Messages
      • Custom Capturing and Rendering
    • API List
    • Released Notes
    • Supported Platforms
    • Web FAQs
      • Optimize Multi-Person Video Calls
      • Handle Autoplay Restriction
      • Handle Firewall Restriction
      • Others
  • Android
    • Run Sample Code
    • Integration
    • Basic Features
      • Sensing Network Quality
      • Enabling Screen Sharing
      • Setting Video Quality
      • Rotating Videos
    • Advanced Features
      • Testing Newwork Quality
      • Custom Capturing and Rendering
      • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • TRTCCloud
      • TRTCStatistics
      • TRTCCloudListener
      • TXAudioEffectManager
      • TXBeautyManager
      • TXDeviceManager
      • Type Definition
      • Deprecated Interface
      • Error Codes
    • Solution
      • Real-Time Chorus (TUIKaraoke)
        • Quick Integration
        • Implementation Steps
        • Song Synchronization
        • Lyric Synchronization
        • Vocal Synchronization
        • Mixing Stream Solution
        • TRTCKaraoke APIs
        • FAQs
    • Release Notes
  • iOS
    • Run Sample Code
    • Integration
    • Basic Features
      • Sensing Network Quality
      • Enabling Screen Sharing
      • Setting Video Quality
      • Rotating Videos
    • Advanced Features
      • Testing Network Quality
      • Custom Capturing and Rendering
      • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • TRTCCloud
      • TRTCCloudDelegate
      • TRTCStatistics
      • TXAudioEffectManager
      • TXBeautyManager
      • TXDeviceManager
      • Type Definition
      • Deprecated Interface
      • ErrorCode
    • Solution
      • Quick Integration
      • Implementation Steps
      • Song Synchronization
      • Lyric Synchronization
      • Vocal Synchronization
      • Mixing Stream Solution
      • TRTCKaraoke APIs
      • FAQs
    • Release Notes
  • macOS
    • Run Sample Code
    • Integration
    • Basic Features
      • Sensing Network Quality
      • Enabling Screen Sharing
      • Sharing Computer Audio
      • Setting Video Quality
      • Rotating Videos
    • Advanced Features
      • Testing Hardware Devices
      • Testing Network Quality
      • Custom Capturing and Rendering
      • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • TRTCCloud
      • TRTCCloudDelegate
      • TRTCStatistics
      • TXAudioEffectManager
      • TXBeautyManager
      • TXDeviceManager
      • Type Definition
      • Deprecated Interface
      • ErrorCode
      • Release Notes
    • Release Notes
  • Windows
    • Run Sample Code
    • Integration
    • Basic Features
      • Sensing Network Quality
      • Enabling Screen Sharing
      • Setting Video Quality
      • Rotating Videos
    • Advanced Features
      • Testing Hardware Devices
      • Testing Network Quality
      • Custom Capturing and Rendering
      • Custom Audio Capturing and Playback
    • Client APIs
      • Overview
      • ITRTCCloud
      • ITRTCStatistics
      • TRTCCloudCallback
      • ITXAudioEffectManager
      • ITXDeviceManager
      • Type Definition
      • Deprecated Interface
      • Error Codes
    • Release Notes
  • Electron
    • Integration
      • 1.API Examples
      • 2.Importing the SDK
      • 3.Entering a Room
      • 4.Subscribing to Audio/Video Streams
      • 5.Publish Audio/Video Streams
      • 6.Exiting a Room
      • 7.Sensing Network Quality
      • 8.Enabling Screen Sharing
      • 9.Sharing Computer Audio
      • 10.Setting Video Quality
      • 11.Rotating Videos
    • Client APIs
      • Overview
      • Error Codes
  • Flutter
    • Integration
      • 1.API Examples
      • 2.Importing the SDK
      • 3.Entering a Room
      • 4.Subscribing to Audio/Video Streams
      • 5.Publish Audio/Video Streams
      • 6.Exiting a Room
      • 7.Sensing Network Quality
      • 8.Enabling Screen Sharing
      • 9.Sharing Computer Audio
      • 10.Setting Video Quality
      • 11.Rotating Videos
    • Client APIs
      • Overview
      • Error Codes
  • Unity
    • Integration
      • 1.API Examples
      • 2Importing the SDK
    • Client APIs
      • Overview
      • Error Codes
  • Qt
    • Integration
      • 1.Importing the SDK
  • Overview
    • Overview
  • Concepts
  • Features
  • Performance Statistics
  • Pricing
    • Free Minutes
    • RTC-Engine Monthly Packages
    • Billing Explanation for Subscription Package Duration
    • Pay-as-you-go
      • Billing of Audio and Video Duration
      • Billing of On-Cloud Recording and Recording Delivery
      • Billing of MixTranscoding and Relay to CDN
  • FAQs
    • FAQs for Beginners
    • Migration Guide
      • Twilio Video to Tencent RTC
      • Billing
      • Features
      • UserSig
      • Firewall Restrictions
      • How to Downsize Installation Package
      • TRTCCalling for Web
      • Audio and Video Quality
      • Others
RTC Engine

Testing Newwork Quality

It is difficult for ordinary users to measure network quality. Before calls are made, we recommend that you test the network speed to get more accurate results on network quality.

Notes

To ensure call quality, do not run the test during a video call.
Speed testing consumes traffic and consequently generates a small traffic fee (almost negligible).

Supported Platforms

iOS
Android
macOS
Windows
Electron
Web
✓ (Reference: Detect Network Quality)

How Speed Testing Works




During speed testing, the SDK sends a batch of probe packets to the server node, measures the quality of return packets, and returns the testing result via a callback API.
The testing result can be used to optimize the SDK's server selection policy, so you are advised to run the test before the first call, which will help the SDK select the optimal server. If the result is unsatisfactory, you can show a UI message asking users to change to a better network.
The test result (TRTCSpeedTestResult) includes the following parameters:
Parameter
Type
Description
success
Success result
Whether the test is successful.
errMsg
Error message
Error message of bandwidth test.
ip
Server address
Testing server IP
quality
Network quality score
Network quality measured by the SDK. Lower packet loss and shorter RTT result in a higher network quality score.
upLostRate
Upstream packet loss rate
Value range: 0-1.0. `0.3` indicates that for every 10 data packets sent to the server, 3 may be lost.
downLostRate
Downstream packet loss rate
Value range: 0-1.0. `0.2` indicates that for every 10 data packets received from the server, 2 may be lost.
rtt
Latency
The time it takes for data to travel from the SDK to the server and back again. The shorter the RTT, the better. The normal range of RTT is 10-100 ms.
availableUpBandwidth
Upstream bandwidth
Estimated upstream bandwidth in Kbps. -1 indicates an invalid value.
availableDownBandwidth
Downstream bandwidth
Estimated downstream bandwidth in Kbps. -1 indicates an invalid value.

How to Test Speed

The speed test feature can be started through the startSpeedTest function of TRTCCloud. The speed test result will be called back through the callback function.
Objective-C
Java
C++
C#
// Sample code for starting speed testing. `sdkAppId` and `UserSig` are required. For how to get them, see Basic Features.
// The example below starts after login.
- (void)onLogin:(NSString *)userId userSig:(NSString *)userSid
{
TRTCSpeedTestParams *params;
// `sdkAppID` is the actual application ID obtained from the console.
params.sdkAppID = sdkAppId;
params.userID = userId;
params.userSig = userSig;
// Expected upstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to test
params.expectedUpBandwidth = 5000;
// Expected downstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to test
params.expectedDownBandwidth = 5000;
[trtcCloud startSpeedTest:params];
}
- (void)onSpeedTestResult:(TRTCSpeedTestResult *)result {
// The speed test result will be called back after the test is completed
}

// Sample code for starting speed testing. `sdkAppId` and `UserSig` are required. For how to get them, see Basic Features.
// The example below starts after login.
public void onLogin(String userId, String userSig)
{
TRTCCloudDef.TRTCSpeedTestParams params = new TRTCCloudDef.TRTCSpeedTestParams();
params.sdkAppId = GenerateTestUserSig.SDKAPPID;
params.userId = mEtUserId.getText().toString();
params.userSig = GenerateTestUserSig.genTestUserSig(params.userId);
params.expectedUpBandwidth = Integer.parseInt(expectUpBandwidthStr);
params.expectedDownBandwidth = Integer.parseInt(expectDownBandwidthStr);
// `sdkAppID` is the actual application ID obtained from the console.
trtcCloud.startSpeedTest(params);
}

// Listen for the test result. Inherit `TRTCCloudListener` and implement the following method.
void onSpeedTestResult(TRTCCloudDef.TRTCSpeedTestResult result)
{
// The speed test result will be called back after the test is completed
}

// Sample code for starting speed testing. `sdkAppId` and `UserSig` are required. For how to get them, see Basic Features.
// The example below starts after login.
void onLogin(const char* userId, const char* userSig)
{
TRTCSpeedTestParams params;
// `sdkAppID` is the actual application ID obtained from the console.
params.sdkAppID = sdkAppId;
params.userId = userid;
param.userSig = userSig;
// Expected upstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to test
param.expectedUpBandwidth = 5000;
// Expected downstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to test
param.expectedDownBandwidth = 5000;
trtcCloud->startSpeedTest(params);
}

// Listen for the testing result
void TRTCCloudCallbackImpl::onSpeedTestResult(
const TRTCSpeedTestResult& result)
{
// The speed test result will be called back after the test is completed
}

// Sample code for starting speed testing. `sdkAppId` and `UserSig` are required. For how to get them, see Basic Features.
// The example below starts after login.
private void onLogin(string userId, string userSig)
{
TRTCSpeedTestParams params;
// `sdkAppID` is the actual application ID obtained from the console.
params.sdkAppID = sdkAppId;
params.userId = userid;
param.userSig = userSig;
// Expected upstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to test
param.expectedUpBandwidth = 5000;
// Expected downstream bandwidth in Kbps. Value range: 10–5000. 0 indicates not to test
param.expectedDownBandwidth = 5000;
mTRTCCloud.startSpeedTest(params);
}

// Listen for the testing result
public void onSpeedTestResult(TRTCSpeedTestResult result)
{
// The speed test result will be called back after the test is completed
}


Speed Test Tool

If you don't want to call an API to test the network speed, you can use the network speed test tool for PC provided by TRTC to quickly get the network quality details.

Test metrics

Metric
Description
WiFi Quality
Wi-Fi signal reception quality
DNS RTT
Tencent Cloud testing domain DNS round-trip time (RTT)
MTR
MTR is a network speed test tool, which can detect the packet loss rate and latency between client and TRTC node and display the details of each hop in the route
UDP Loss
UDP packet loss rate between client and TRTC node
UDP RTT
UDP latency between client and TRTC node
Local RTT
Latency between client and local gateway
Upload
Estimated upstream bandwidth
Download
Estimated downstream bandwidth

Tool screenshots

Quick test:

Continuous test: