Introduction

You can conduct a last mile network quality test before a call to check if the network supports the audio bitrate or target bitrate of the chosen video profile before a user joins a channel. The onLastmileQuality callback reports the test results once every two seconds. The test results are based on the network quality ratings determined by the packet-loss rates and network jitter, which reflect the uplink network quality of the client.

The audio SDK uses a fixed bitrate of 48 Kbps.
The video SDK adjusts the actual bitrate according to the chosen video profile.

Implementation

Initialize rtcEngine before running the following sample code.

    // Call the enableLastmileTest function before joining a channel. 
    rtcEngine.enableLastmileTest();

    // The onLastmileQuality callback is in the global IRtcEngineEventHandler.
    public void onLastmileQuality(int quality) {
         // quality means the detected network quality type. You can use it for related logic. 
        // ⑴ You can choose to end the last mile test in the callback. 
        rtcEngine.disableLastmileTest();
    }

    // ⑵ You can also choose to end the last mile test at any time. Before the test ends, the onLastmileQuality callback can be returned multiple times. 
    rtcEngine.disableLastmileTest();

API Methods

Considerations

  • You can conduct a last mile test only before joining a channel.
  • The onLastmileQuality callback may return UNKNOWN the first time it is triggered. Subsequent callbacks will return the test results.