-
Notifications
You must be signed in to change notification settings - Fork 2
Network Quality Events
To provide better feedback during RTC calls with other users, you can subscribe to network quality events.
These events are used to inform the user of their local network quality. With such information, it is possible to determine when call quality is being affected by deteriorating network quality.
To use these events, one must set the NetworkQualityEventListener.
This is possible by using the setNetworkQualityEventListener method on
the Call, ApplicationCall
and RoomCall objects. The following example shows setting
the NetworkQualityEventListener on
a Call object.
private void example() {
InfobipRTC infobipRTC = InfobipRTC.getInstance();
WebrtcCall webrtcCall = (WebrtcCall) infobipRTC.getActiveCall();
webrtcCall.setNetworkQualityEventListener(networkQualityChangedEvent -> {
NetworkQuality networkQuality = networkQualityChangedEvent.getNetworkQuality();
Log.d("WebRTC", String.format("Local network quality is: %s (score: %s)", networkQuality, networkQuality.getScore()));
});
}This event contains a NetworkQuality object which is an enum that describes the quality of the
network in five levels ranging from BAD to EXCELLENT. The
numerical values of these enums are from 1 to 5, the latter being the best quality correlating
to EXCELLENT.
It is worth noting that the network quality is highly dependent on your demands. A network that can have an excellent quality during a voice call might drop to fair quality while using video.