atmoky Engage Server SDK is now available! Check out the documentation to learn more.
Documentation
Real-time Communication
Bandwidth Optimizations

Bandwidth Optimizations

With publishing and subscribing to video tracks, the bandwidth usage can increase significantly. The Engage SDK provides several ways to help reducing it.
One is to reduce the published resolution of the video track and/or to limit the bitrate of the video encoder. The other set of optimizations is the combination of Simulcast, Adaptive Stream, and Dynacast.

Video Resolution and Encoding Quality

With the VideoCaptureOptions and TrackPublishOptions you can control the resolution of the captured video stream, and the bitrate of the video encoder, effectively controlling the required upstream bandwidth.
import { VideoPresets } from "@atmokyaudio/engage-client";
 
const preset = VideoPresets.h720; // VideoPresets.h1080, VideoPresets.h360, ...
const captureOptions = { resolution: preset.resolution };
const publishOptions = { videoEncoding: preset.encoding };
localParticipant.setCameraEnabled(true, captureOptions, publishOptions);
This example uses one of the available presets for the video resolution and encoding quality. You can also set these values manually see VideoResolution and VideoEncoding

Simulcast and Adaptive Stream

With simulcast, the SDK will automatically publish multiple versions of the same video track with different quality settings. This allows the subscriber to choose the best quality for their current network conditions, or current size of the video element playing back the video track.
Simulcast can be enabled when publishing a video track:
const publishOptions = { simulcast: true };
 
// publishing with setCameraEnabled wrapper
const videoCaptureOptions = undefined;
localParticipant.setCameraEnabled(true, videoCaptureOptions, publishOptions);
 
// publishing LocalTrack directly
localParticipant.publishTrack(localVideoTrack, publishOptions);
On the subscriber side, you can select the simulcast layer to subscribe to:
const remoteVideoTrack = remoteParticipant.getTrack(Track.Source.Video)!;
remoteVideoTrack.setVideoQuality(VideoQuality.LOW);
// other options: VideoQuality.MEDIUM, VideoQuality.HIGH

Adaptive Stream

Adaptive Stream is a mechanism that allows the SDK to automatically switch between simulcast layers based on the size of the video element playing back the video track. So for small video elements, the SDK will automatically switch to a lower quality simulcast layer, and for larger video elements, the SDK will automatically switch to a higher quality simulcast layer.
Adaptive Stream can be enabled when joining a room:
const roomOptions = { adaptiveStream: true };
space.joinRoom(url, token, roomOptions);
With Adaptive Stream enabled, a manual call to setVideoQuality will be ignored.

Dynacast

Dynacast uses the same mechanism as Adaptive Stream and Simulcast, but it is used on the publishing side. With dynacast enabled, the SDK will automatically stop the transmission of a video track (or individual simulcast layers) if the video track is not visible to any subscriber. If the video track becomes visible again, the SDK will automatically restart the transmission.
Dynacast can be enabled when joining a room:
const roomOptions = { dynacast: true };
space.joinRoom(url, token, roomOptions);

atmoky Logo

© 2024 atmoky, GmbH.
All rights reserved.

We use cookies to measure and improve your browsing experience, and serve personalized ads or content.