Live SDKs iOS v1
Live SDKs iOS
Live SDKs
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 functionalities to configure the quality of video streaming during a live event, and to notify the users whenever the connection quality changes throughout the event.

Video streaming settings

Copy link

When streaming video content as hosts, it is essential to consider the fluctuations in network conditions that may occur during the stream. You can allow hosts to set and adjust their video quality settings through mediaOptions.videoQualityConstraints.

Note: The video quality settings are needed only when the live event's type is set to video. Each host in the event can configure their own settings according to their preference.

While WebRTC automatically adjusts the media quality based on the available network capacity, there are instances where fine-tuning specific properties becomes necessary to align with the purpose and requirements of the event.

For example, in conference event streams, emphasis may be placed on video resolutions to ensure clear visuals, while in sport event streams, the focus might be on maintaining a higher video frame rate to capture fast-paced action accurately.

Specify videoQualityConstraints

Copy link

When starting the stream as hosts, set the following three parameters in MediaOptions.

let videoQualityConstraints = VideoQualityConstraints(resolution: Resolution(width: 720, height: 1280), fps: 24, degradationPreference: .auto)
mediaOptions.videoQualityConstraints = videoQualityConstraints

liveEvent.startStreaming(mediaOptions: mediaOptions) { error in 
  guard error == nil else { return } // Handle error
  // The streaming has started with the given media options. 

List of the MediaOptions parameters

Copy link


Specifies the video resolution that the WebRTC stream uses.


Specifies the frames per second for the WebRTC Video stream.


Specifies a degradation preference to prioritize a specific aspect of the stream.
- maintainResolution: This ensures that the resolution of the video stream remains unchanged even if the network conditions deteriorate. It prioritizes maintaining a clear visual experience in compensation of smoothness of the video.

- maintainFps: This ensures that the frame rate of the video stream remains consistent even if the network conditions degrade. It prioritizes maintaining smooth and fluid motion in compensation of clear video quality.

- auto: With this option, WebRTC automatically adjusts both the resolution and frame rate based on the network conditions, finding the best balance between visual clarity and smooth motion.

Note: Before setting these parameters, check the supported resolution or fps on your device. If you set a resolution or fps value that is not supported by the device, or don't set either of the two, the system will automatically set an approximate value.

Adjust the settings during streaming

Copy link

While the initial configuration sets the video quality constraints, it's important to note that WebRTC's adaptive nature adjusts the media quality based on network conditions as well.

However, if you find the need to make real-time adjustments to the video quality during the live event, use the updateVideoQualityConstraints() function.

This function allows you to modify the current resolution, FPS, or other quality parameters on the fly to better adapt to changing network conditions or specific event requirements. By dynamically adjusting these constraints, you can ensure a smooth streaming experience for the audience.

// Set the resolution to 720P, FPS to 12, and configure the video to maintain resolution but drop fps. 
let videoQualityConstraints = VideoQualityConstraints(resolution: Resolution(width: 720, height: 1280), fps: 12, degradationPreference: .maintainResolution)

liveEvent.updateVideoQualityConstraints(videoQualityConstraints) { error in 
  guard error == nil else { return } // Handle error.

  // Video quality constraints has been updated.

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 ConnectionQualityDelegate and create an indicator to inform the status to the users.

Set ConnectionQualityDelegate

Copy link

To detect changes in connection quality, you need to set ConnectionQualityDelegate and select a monitoring mode by calling the setConnectionQualityDelegate() method. Whenever there is a change in connection quality, the didConnectionQualityUpdate method will be called according to the specified mode.

List of the monitoring modes

Copy link


Monitors the connection quality every three seconds after the onConnectionQualityUpdate() method is called.


Monitors the changes in connection quality level which can call the didConnectionQualityUpdate() method.

Remove ConnectionQualityDelegate

Copy link

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


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.

class ConnectionMetrics { 
  var packetLostRate: Double
  var roundTripTime: Double // Only for host
  var jitter: Double? // Only for participant
  var bandwidth: Double?
  var availableBitrate: Double?

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



0ms - 150ms










Very Poor

> 5%

> 300ms

Based on the ConnectionQuality enum, 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.