Live SDKs JavaScript v1
Live SDKs JavaScript
Live SDKs
JavaScript
Version 1

Live quality management

Copy link

When users participate in a live event, network connection may fluctuate throughout the event, affecting the streaming quality. In such case, you might want to notify users of their network quality, rather than having the event interrupted without any alert.

Sendbird Live provides a functionality to notify the users whenever the connection quality changes throughout the event.


Connection quality indicator

Copy link

You can notify both hosts and participants whenever there is a change in their network connection status during the live event. To do so, listen to events related to the connection quality change through ConnectionQualityListener and create an indicator to inform the status to the users.

Set ConnectionQualityListener

Copy link

To detect changes in connection quality, you need to set its ConnectionQualityListener by calling the LiveEvent.setConnectionQualityListener() method. The ConnectionQualityListener will be called every three seconds.

Remove ConnectionQualityListener

Copy link

When the listener is no longer needed, remove it and all previous settings by calling the LiveEvent.removeConnectionQualityListener() method.

liveEvent.removeConnectionQualityListener();

Connection metrics

Copy link

The connection quality data can vary by each host and participant in a live event, and this can be quantified and analyzed by ConnectionMetrics.

export interface ConnectionMetrics {
  packetsLostRate: number;
  rtt?: number; // Only for host
  jitter?: number; // Only for participant
}

While you have flexibility to define connection quality value ranges that correspond to different quality levels, here’s a general guideline for interpreting these ranges and setting up the corresponding enumeration values.

How to read ConnectionMetrics

Copy link
Quality levelPacket Lost RateRound Trip Time

Excellent

0%-0.5%

0ms - 150ms

Good

0.5%-1%

150ms-200ms

Fair

1%-2.5%

200ms-250ms

Poor

2.5%-5%

250ms-300ms

Very Poor

> 5%

> 300ms

Based on the ConnectionMetrics, you can assess the current quality of the streaming and implement appropriate actions to improve it. For example, you might display a quality degradation alert to the user if the connection quality drops below average.