await call.setPreferredIncomingVideoResolution(VideoResolution(width: 640, height: 480));
Manual Video Quality Selection
By default, our SDK chooses the incoming video quality that best matches the size of a video element for a given participant. It makes less sense to waste bandwidth receiving Full HD video when it’s going to be displayed in a 320 by 240 pixel rectangle.
However, it’s still possible to override this behavior and manually request higher resolution video for better quality, or lower resolution to save bandwidth. It’s also possible to disable incoming video altogether for an audio-only experience.
Overriding Preferred Resolution
To override the preferred incoming video resolution, use the call.setPreferredIncomingVideoResolution
method:
Actual incoming video quality depends on a number of factors, such as the quality of the source video, and network conditions. Manual video quality selection allows you to specify your preference, while the actual resolution is automatically selected from the available resolutions to match that preference as closely as possible.
It’s also possible to override the incoming video resolution for only a selected subset of call participants. The call.setPreferredIncomingVideoResolution()
method optionally takes a list of participant session identifiers as its optional argument. Session identifiers can be obtained from the call participant state:
final [first, second, ..._] = call.state.value.otherParticipants;
// Set preferred incoming video resolution for the first two participants only:
await call.setPreferredIncomingVideoResolution(
VideoResolution(width: 640, height: 480),
sessionIds: [first.sessionId, second.sessionId],
);
Calling this method will enable incoming video for the selected participants if it was previously disabled.
To clear a previously set preference, pass null
instead of resolution:
// Clear resolution preference for selected participants:
await call.setPreferredIncomingVideoResolution(
null,
sessionIds: [
participant.sessionId,
],
);
// Clear resolution preference for all participants:
await call.setPreferredIncomingVideoResolution(null);
Disabling Incoming Video
To completely disable incoming video (either to save data, or for an audio-only experience), use the call.setIncomingVideoEnabled()
method:
await call.setIncomingVideoEnabled(false);
To enable incoming video again, pass true
as an argument:
await call.setIncomingVideoEnabled(true);
Calling this method will clear the previously set resolution preferences.