Dual Stream Mode
Dual stream mode refers to publishing both a high-quality (large) and a low-quality (small) video stream when sharing video resources.
The SDK enables dual stream publishing by default, automatically generating both streams for each video publisher. The small stream's resolution automatically follows the large stream's settings.
In multi-party RTC calls, dual stream mode effectively reduces downstream bandwidth consumption. Subscribers can optionally request the small stream as needed.
The resolution mapping between small and large streams is as follows:
Large Stream Resolution | Small Stream Resolution | Aspect Ratio |
---|---|---|
176X144 | 176X144 | 11:9 |
180X180 | 180X180 | 1:1 |
256X144 | 256X144 | 16:9 |
240X180 | 240X180 | 4:3 |
320X180 | 256X144 | 16:9 |
240X240 | 180X180 | 1:1 |
320X240 | 240X180 | 4:3 |
360X360 | 180X180 | 1:1 |
480X360 | 240X180 | 4:3 |
640X360 | 256X144 | 16:9 |
480X480 | 180X180 | 1:1 |
640X480 | 240X180 | 4:3 |
720X480 | 240X180 | 3:2 |
848X480 | 256X144 | 9:5 |
960X720 | 240X180 | 4:3 |
1280X720 | 256X144 | 16:9 |
1920X1080 | 256X144 | 16:9 |
Enabling/Disabling Dual Stream
Configure dual stream mode during engine initialization by specifying the video setup parameters. When enabled, publishers will automatically generate both streams.
/// Enable dual stream during engine creation
RCRTCVideoSetup videoSetup = RCRTCVideoSetup.create(enableTinyStream: true);
RCRTCEngineSetup engineSetup = RCRTCEngineSetup.create(videoSetup: videoSetup);
engine = RCRTCEngine.create(engineSetup);
/// Disable dual stream during engine creation
RCRTCVideoSetup videoSetup = RCRTCVideoSetup.create(enableTinyStream: false);
RCRTCEngineSetup engineSetup = RCRTCEngineSetup.create(videoSetup: videoSetup);
engine = RCRTCEngine.create(engineSetup);
Configuring Small Stream Properties
When dual stream is enabled, set small stream parameters by passing true
to the tiny
parameter in setVideoConfig
:
RCRTCVideoConfig config = RCRTCVideoConfig.create(
minBitrate: 200,
maxBitrate: 900,
fps: RCRTCVideoFps.fps_15,
resolution: RCRTCVideoResolution.resolution_480_640,
);
engine.setVideoConfig(config, true);
Switching Streams as Subscriber
If remote users enabled dual stream before joining, local subscribers can request either stream via the tiny
parameter in subscribe
:
/// Subscribe to large stream
engine.subscribe(userId, RCRTCMediaType.audio_video, false);
/// Subscribe to small stream
engine.subscribe(userId, RCRTCMediaType.audio_video, true);