You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Video Constraints API is a powerful tool that enables developers to control the video quality from within their video calls. With this API, developers can set constraints on the video resolution to ensure that the video call is optimized for the user's device and network conditions. The ACS video engine is optimized to allow the video quality to change dynamically based on devices ability and network quality. But there might be certain scenarios where you would want to have tighter control of the video quality that end users will experience. For example, there might be cases when pushing the highest video quality isn't a top priority or you may want to limit the video bandwidth usage in the application. To support this, you can use the Video Constraints API to have tighter control video quality.
20
+
The Video Constraints API is a powerful tool that enables developers to control the video quality from within their video calls. With this API, developers can set constraints on the video resolution to ensure that the video call is optimized for the user's device and network conditions. The ACS video engine is optimized to allow the video quality to change dynamically based on devices ability and network quality. But there might be certain scenarios where you would want to have tighter control of the video quality that end users experience. For instance, there may be situations where the highest video quality is not a priority or you may want to limit the video bandwidth usage in the application. To support those use cases, you can use the Video Constraints API to have tighter control over video quality.
21
21
22
22
Another benefit of the Video Constraints API is that it enables developers to optimize the video call for different devices. For example, if a user is using an older device with limited processing power, developers can set constraints on the video resolution to ensure that the video call runs smoothly on that device
23
23
24
-
Currently ACS supports setting the maximum video resolution that a client will send. The maximum resolution is set at the start of the call and is static throughout the entire call. The sender max video resolution constraint is supported on Desktop browsers (Chrome, Edge, Firefox) and when using iOS Safari mobile browser.
24
+
ACS Calling SDK (Web) currently supports setting the maximum video resolution that a client sends. The maximum resolution is set at the start of the call and is static throughout the entire call. The sender max video resolution constraint is supported on Desktop browsers (Chrome, Edge, Firefox) and when using iOS Safari mobile browser.
25
25
26
-
> [!NOTE]
27
-
> Video Constraints is currently supported only for our JavaScript / Web SDK, and is available starting in version [1.11.0-beta.1](https://www.npmjs.com/package/@azure/communication-calling/v/1.11.0-beta.1) of the Calling SDK.
26
+
ACS Calling SDK (Android/iOS/Windows) currently supports setting the maximum values of video resolution and framerate for outgoing video streams and setting the maximum resolution for incoming video streams. The constraints can be set at the start of the call and during the call.
28
27
29
-
> [!NOTE]
30
-
> Future versions of the Video Contraint API will allow enhanced ability by giving control to set the maximum FPS and bitrate, as well as the ability to enforce the video constraint at different points of a call (and not just at the start of a video call).
28
+
## Supported constraints
31
29
32
-
## Using video constraints
33
-
The video constraints setting is implemented on the `Call` interface. To use the Video Constraints, you can specify the constraints from within CallOptions when you make a call, accept a call, or join a call. You will also have to specify `localVideoStreams` in `videoOptions`. Do note that constraints don't work if you join a call with audio only option and turn on the camera later.
With sender max video resolution constraint, you can limit the max video resolution of the sending stream. The value you have to provide for this constraint is `height`.
80
-
81
-
```javascript
82
-
{
83
-
localVideoStreams: [...],
84
-
constraints: {
85
-
send: {
86
-
height: {
87
-
max:240
88
-
}
89
-
}
90
-
}
91
-
}
92
-
```
93
-
When setting the maximum resolution video constraints, the SDK will choose the nearest resolution that falls within the constraint set (to prevent the resolution height doesn't exceed the maximum constraint value allowed). Also, when the resolution constraint value is too small, the SDK will choose the smallest available resolution. In this case, the height of chosen resolution can be larger than the constraint value.
94
-
95
-
> [!NOTE]
96
-
> The resolution constraint is a `max` constraint, which means the possible resolutions can be the specified resolution or smaller.
97
-
> There is no gurantee that the sent video resolution will remain at the specified resolution.
98
-
99
-
The `height` in `VideoSendConstraints` has a different meaning when a mobile device is in portrait mode. In portrait mode, this value indicates the shorter side of the device. For example, specifying `constraints.send.height.max` value with 240 on a 1080(W) x 1920(H) device in portrait mode, the constraint height is on the 1080(W) side. When the same device is in landscape mode (1920(W) x 1080(H)), the constraint is on the 1080(H) side.
100
-
101
-
If you use MediaStats API to track the sent video resolution, you may find out that the sent resolution can change during the call. It can go up and down, but should be equal or smaller than the constraint value you provide. This resolution change is an expected behavior. The browser also has some degradation rule to adjust sent resolution based on cpu or network conditions.
102
-
103
-
### Media stats
104
-
To evaluate and compare the video quality after applying the video constraints, you can access [MediaStats API](./media-quality-sdk.md) to get video resolution and bitrate information of the sending stream. The media stats also include other granular stats related to the streams, such as jitter, packet loss, round trip time, etc.
The Video Constraints API enables developers to control the video quality from within their video calls. In this quickstart guide, we illustrate how to use the API to set the constraints.
18
+
19
+
### Prerequisites
20
+
Refer to the [Voice Calling Quickstart](../../getting-started-with-calling.md?pivots=platform-android) to set up a sample app with voice calling.
21
+
22
+
### Classes
23
+
| Name | Description |
24
+
| - | - |
25
+
| VideoConstraints | Used to hold both incoming video constraints and outgoing video constraints. |
26
+
| OutgoingVideoConstraints | Used to specify constraints (`maxWidth | maxHeight | maxFrameRate`) for outgoing video streams. |
27
+
| IncomingVideoConstraints | Used to specify constraints (`maxWidth | maxHeight`) for incoming video streams. |
28
+
29
+
### Using video constraints
30
+
31
+
The following sections explain how the video constraints can be set for incoming and/or outgoing video streams at different times of a call.
32
+
33
+
#### Set video constraints before starting a call
34
+
35
+
For *incoming* video streams, an `IncomingVideoConstraints` needs to be added to the `IncomingVideoOptions`.
Instead of setting the video constraints before starting a call, you can also dynamically adjust the video constraints during a call. You need to call `setVideoConstraints` on your `Call` type class and provide the constraints.
To reset/remove the video constraints you previously set, you have to follow the above pattern and provide `0` as a constraint value. Providing `null` values for either `IncomingVideoConstraints` or `OutgoingVideoConstraints` won't reset/remove the constraints and the constraints with a `null` value will be ignored.
89
+
90
+
### Limitations
91
+
92
+
> [!NOTE]
93
+
> Please make sure you are aware of these limitations when using the Video Constraints API.
94
+
> Some of the limitations will be removed in future releases.
95
+
96
+
There are some known limitations to the current Video Constraints API.
97
+
98
+
* The constraint is a **max** constraint, which means the possible constraint value can be the specified value or smaller. There's no guarantee that the actual value remains the same as user-specified.
99
+
100
+
* When the user sets a constraint value that is too small, the SDK will use the smallest available value that is supported.
101
+
102
+
* For setting `OutgoingVideoConstraints` during a call, the current ongoing video stream doesn't automatically pick up the constraints specified. In order to make the constraints take effect, you need to stop and restart the outgoing video.
103
+
104
+
*`IncomingVideoConstraints` currently is a user-preferred constraint instead of a hard constraint, which means that depending on your network and hardware, the actual value received may still exceed the constraint set.
105
+
106
+
### Media stats
107
+
To evaluate and compare the video quality after applying the video constraints, you can access [MediaStats API](../../../../concepts/voice-video-calling/media-quality-sdk.md) to get video resolution and bitrate information of the stream. The media stats also include other granular stats related to the streams, such as jitter, packet loss, round trip time, etc.
0 commit comments