Skip to content

Commit 282c2d1

Browse files
committed
docs: add plain js docs
1 parent f415288 commit 282c2d1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
id: manual-video-quality-selection
3+
title: Manual Video Quality Selection
4+
---
5+
6+
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.
7+
8+
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.
9+
10+
## Overriding Preferred Resolution
11+
12+
To override the preferred incoming video resolution, use the `call.setPreferredIncomingVideoResolution` method:
13+
14+
```js
15+
await call.setPreferredIncomingVideoResolution({ width: 640, height: 480 });
16+
```
17+
18+
:::note
19+
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.
20+
:::
21+
22+
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:
23+
24+
```js
25+
const [firstParticipant, secondParticipant] = call.state.participants;
26+
// Set preferred incoming video resolution for the first two participants only:
27+
await call.setPreferredIncomingVideoResolution({ width: 640, height: 480 }, [
28+
[firstParticipant.sessionId, secondParticipant.sessionId],
29+
]);
30+
```
31+
32+
Calling this method will enable incoming video for the selected participants if it was previously disabled.
33+
34+
To clear a previously set preference, pass `undefined` instead of resolution:
35+
36+
```js
37+
// Clear resolution preference for selected participants:
38+
await call.setPreferredIncomingVideoResolution(undefined, [
39+
participant.sessionId,
40+
]);
41+
// Clear resolution preference for all participants:
42+
await call.setPreferredIncomingVideoResolution(undefined);
43+
```
44+
45+
## Disabling Incoming Video
46+
47+
To completely disable incoming video (either to save data, or for an audio-only experience), use the `call.setIncomingVideoEnabled` method:
48+
49+
```js
50+
await call.setIncomingVideoEnabled(false);
51+
```
52+
53+
To enable incoming video again, pass `true` as an argument:
54+
55+
```js
56+
await call.setIncomingVideoEnabled(true);
57+
```
58+
59+
Calling this method will clear the previously set resolution preferences.

0 commit comments

Comments
 (0)