Network Quality Reports

Network Icons

Video/Audio conferencing is by nature a data-intensive operation. The 100ms SDK attempts to stabilize connections especially if subscribe degradation is turned on in the template but it's possible for really bad connections users will still have problems.

It can be helpful to measure a user's connection speed before joining a room to set expectations or decide to have them join with video off etc.

The 100ms SDK provides a way to measure the user's downlink speed in the preview screen.

⚠️ The downlink speed is measured by having the user download a file (1MB as of this writing) after the WebSocket connection is established during a preview.

The download will be continued for at most a fixed number of seconds (for example 10 seconds) and the speed during that interval is calculated. The entire file may not be downloaded if it exceeds the timeout.

DNS time is not counted in this, only throughput is measured.

Requesting/Reading a Network Quality Update in Preview

When creating an HMSConfig object to request a preview, set the captureNetworkQualityInPreview to true to measure the user's downlink network quality.

class Preview implements HMSPreviewListener{ ... late HMSSDK hmsSDK; Preview(){ initHMSSDK(); } void initHMSSDK() async { hmsSDK = HMSSDK(); await hmsSDK.build(); // ensure to await while invoking the `build` method HMSConfig config = HMSConfig( userName: "John Doe", authToken: "eyJH5c", //Setting this to true enables network quality reports in the preview captureNetworkQualityInPreview: true, ); hmsSDK.addPreviewListener(listener: this); hmsSDK.preview(config: config); } }

Fetch Network quality reports

When available, the information will be returned in onPeerUpdate of the HMSPreviewListener and HMSUpdateListener in the update type HMSPeerUpdate.networkQualityUpdated. It can be retrieved out of the HMSPeer object's networkQuality property.

🔑 Note: The update is only fired when there is a change in peer's network quality value.

Here's the class definition of HMSNetworkQuality, which is a property on the HMSPeer.

class HMSNetworkQuality( int quality; )

In Preview

We can find the updates through onPeerUpdate callback in HMSPreviewListener

class Preview implements HMSPreviewListener{ ... void onPeerUpdate({required HMSPeer peer, required HMSPeerUpdate update}) { if (update == HMSPeerUpdate.networkQualityUpdated) { print("Network Quality of ${peer.name} in Preview ${peer.networkQuality?.quality}"); } } }

In Room

We can find the updates through onPeerUpdate callback in HMSUpdateListener

class Meeting implements HMSUpdateListener{ ... void onPeerUpdate({required HMSPeer peer, required HMSPeerUpdate update}) { if (update == HMSPeerUpdate.networkQualityUpdated) { print("Network Quality of ${peer.name} in Room ${peer.networkQuality?.quality}"); } } }

Interpreting the Values

peer.networkQuality?.quality will be a value between -1 and 5.

  • -1 -> Network check failure
  • 0 -> Very bad network or network check failure.
  • 1 -> Poor network.
  • 2 -> Bad network.
  • 3 -> Average.
  • 4 -> Good.
  • 5 -> Best.

Have a suggestion? Recommend changes ->

Was this helpful?

1234