Show Network Quality For Peers

Network Quality Information

The network quality for every peer can be retrieved by registering an instance of HmsUpdateListener in hmsSDK.

Limitations

The network quality information per peer is calculated by the server by observing how well the peer can download other peer's videos.

⚠️ If the peer is not subscribing to any videos network quality updates will NOT be sent for them to anyone in the call.

This depends only on what videos that peer is seeing, so it's possible in a large call that some people have on-screen only degraded tiles, or tiles where others have videos off and the peer who can't see the videos will not have any network quality information about them sent to others.

Reading Network Quality Information

Whenever peer network quality changes an update will be fired to onPeerUpdate(update : HMSPeerUpdate, peer : HMSPeer) of HMSUpdateListener where the update value will be of type HMSPeerUpdate.NETWORK_QUALITY_UPDATED.

💡TheHMSPeer object represents a person in the call.

It could look something like this:

override fun onPeerUpdate(type: HMSPeerUpdate, hmsPeer: HMSPeer) { when (type) { HMSPeerUpdate.NETWORK_QUALITY_UPDATED -> { // values can be accessed using hmsPeer.networkQuality?.downlinkQuality val quality = hmsPeer.networkQuality?.downlinkQuality } } }

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

Interpreting the Values

peer.networkQuality?.downlinkQuality will be a value between 0 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