-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from GetStream/feature/update-docs-2
[Docs] add info about controlling published video resolution + add new page on video optimization
- Loading branch information
Showing
6 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Packages/StreamVideo/DocsCodeSamples/03-guides/VideoOptimization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Threading.Tasks; | ||
using StreamVideo.Core; | ||
|
||
namespace DocsCodeSamples._03_guides | ||
{ | ||
internal class VideoOptimization | ||
{ | ||
public async Task ControlParticipantVideoResolution() | ||
{ | ||
var callType = StreamCallType.Default; // Call type affects default permissions | ||
var callId = "my-call-id"; | ||
|
||
// Notice that we pass create argument as true - this will create the call if it doesn't already exist | ||
var streamCall = await _client.JoinCallAsync(callType, callId, create: true, ring: false, notify: false); | ||
|
||
foreach (var participant in streamCall.Participants) | ||
{ | ||
participant.UpdateRequestedVideoResolution(new VideoResolution(1280, 720)); | ||
} | ||
} | ||
|
||
private IStreamVideoClient _client; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Packages/StreamVideo/DocsCodeSamples/03-guides/VideoOptimization.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: Video Optimization | ||
description: Best practices for video optimization | ||
--- | ||
|
||
Many factors affect the smoothness of video transitions, one of which is the optimal usage of network bandwidth. Network bandwidth represents the maximum data capacity that a user can send and receive through the network. Given video's substantial size, providing a good real-time video experience requires transferring sufficient data to maintain an appropriate number of frames per second (FPS). However, attempting to send too much data can result in video stuttering. | ||
|
||
## Dynamic resolution scaling | ||
|
||
The Stream service automatically adjusts the video resolution and framerate delivered to each call participant based on current network conditions to ensure smooth video transmission. In extreme cases where a participant's bandwidth capacity is insufficient for both video and audio, the Stream service may temporarily pause video to preserve audio streaming quality. | ||
|
||
Stream media servers actively monitor network conditions and optimize the data delivered to each participant. However, there are certain actions you can take to make this process as efficient as possible. | ||
|
||
## Control requested video resolution per participant | ||
|
||
A practical approach is to request video tracks at the resolution that matches your actual rendering needs. This minimizes UI scaling and optimizes bandwidth usage. | ||
|
||
By default, video is delivered at 1080p (1920x1080) resolution. While this ensures high-quality video, it may be excessive depending on your UI layout. For example, if your application displays participants in a small grid, where each participant's video occupies a maximum of 480x270 pixels, you would be transferring four times more data than necessary. This excessive data transfer, due to down-scaling, can lead to bandwidth issues. | ||
|
||
To request a specific video resolution for each call participant, use the UpdateRequestedVideoResolution method on the IStreamVideoCallParticipant object as shown below: | ||
```csharp | ||
participant.UpdateRequestedVideoResolution(new VideoResolution(1280, 720)); | ||
``` | ||
Invoke this method whenever the rendered resolution changes. | ||
|
||
## Video Frame Rate recommendations | ||
|
||
The ideal frames per second (FPS) for video transmission varies by use case. Below are general recommendations: | ||
|
||
| Use case | FPS (frames per second) | Comment | | ||
| --- | --- | --- | | ||
| Video Calling & Broadcasting | 30 | Typically, 30FPS is sufficient for standard video calls and broadcasting. | | ||
| Screen-sharing | 10-15 | A lower FPS is usually adequate, but a high resolution is recommended to prevent artifacts and ensure clarity. | | ||
| E-Sports streaming | 50-60 | Fast-paced action requires a higher frame rate for smooth playback. | | ||
|
||
|