Skip to content

Auto-Disable Video for Poor Connections via Simulcast

Rhoena Endaya Aug 15, 2024 10:29:21 AM
Auto-Disable Video for Poor Connections via Simulcast
4:05

In LiveSwitch 1.21, we’ve enhanced our simulcast implementation to automatically disable video for participants with poor connectivity. If a participant is struggling to receive video, even on the lowest quality stream, this feature kicks in to ensure a smoother experience for the user by disabling the video.

This update builds on the improvements introduced in LiveSwitch 1.20, which we detailed in this previous blog post.

Simulcast must be enabled to use this feature, and this is available on both server-side and client-side simulcast.

 

How It Works

When a participant (receiver) is on the lowest available encoding layer but still experiences connection issues (indicated by metrics like NACKs and PLIs), this feature will automatically turn off their video. 

 

Video Retention Policy

Our customers may have varying preferences on how this functionality should be adapted to their application based on their unique use case, so we have provided three options for handling video for participants with poor network connectivity:

  • AlwaysRetain: Video remains enabled regardless of connection quality.
  • DynamicRetention: Video is dynamically enabled or disabled based on configuration settings, which we’ll discuss further below.
  • NeverRetain: Video is disabled at the first sign of connectivity failure and remains off.

These settings can be customized on a per-connection basis.

Here is an example of how to set this policy:

downstreamConnection.setVideoRetentionPolicy
(fm.liveswitch.VideoRetentionPolicy.DynamicRetention);

 

Video Enable Update Connection Policy

Available with the DynamicRetention policy, this feature allows customers to control the interval between attempts to re-enable video and the number of retries before the video is permanently disabled.

By default, when we detect a struggling user on the lowest encoding layer, we disable their video. We then wait 30 seconds before attempting to re-enable it. If the user is struggling, we disable the video again, increment the wait by another 30 seconds, and make another attempt. After the third attempt, the video is permanently disabled. 

While we have a default configuration, we always aim to provide flexibility to our customers to control the implementation that best suits their use case. Hence, our customers can override this default behavior and set their own intervals and retry attempts using the method outlined below:

downstreamConnection.setVideoEnabledUpdateConnectionPolicy
(function (attempts) {
    if (attempts >= 3) {
        return -1;
    }

    return 30 + (attempts * 30);
});

 

Lastly, to ensure a seamless experience for our customers' end users, we also provided a way to notify them that  them that their video streams have been switched on or off through this event:

downstreamConnection.addOnVideoEnabledChange
((connection, videoEnabled) =>
{
   if(videoEnabled)
   {
      // TODO: Add view back in
   }
   else
   {
      // TODO: Remove view
   }
});

 

Summary

LiveSwitch 1.21 introduces a crucial improvement to our simulcast functionality by automatically disabling video for participants with poor connectivity. This feature ensures a smoother user experience, even under challenging network conditions, by leveraging server-side and client-side simulcast. With customizable video retention policies—AlwaysRetain, DynamicRetention, and NeverRetain—you have full control over how video is managed for participants struggling with their connection. Whether you're working with the default settings or fine-tuning the intervals and retries, this update provides the flexibility and stability needed for seamless video communication.

Enable simulcast and experience these enhancements across all platforms, with full support on Chrome. Check out more details on our Simulcast documentation


Experience the Future of WebRTC with a 30-Day Free Trial!

Ready to build your ideal WebRTC application? Our expert team is here to make it happen. Start your trial and connect with us today!