Skip to main content

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:

await call.setPreferredIncomingVideoResolution({ width: 640, height: 480 });
note

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 an array of participant session identifiers as its second argument. Session identifiers can be obtained from the call participant state:

const [firstParticipant, secondParticipant] = call.state.participants;
// Set preferred incoming video resolution for the first two participants only:
await call.setPreferredIncomingVideoResolution({ width: 640, height: 480 }, [
[firstParticipant.sessionId, secondParticipant.sessionId],
]);

Calling this method will enable incoming video for the selected participants if it was previously disabled.

To clear a previously set preference, pass undefined instead of resolution:

// Clear resolution preference for selected participants:
await call.setPreferredIncomingVideoResolution(undefined, [
participant.sessionId,
]);
// Clear resolution preference for all participants:
await call.setPreferredIncomingVideoResolution(undefined);

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.

Did you find this page helpful?