Additional outputs tweaks + fix track constraints (#28)

* code

* add code

* add code
This commit is contained in:
Freddy Boulton
2024-12-03 15:32:43 -05:00
committed by GitHub
parent 65d0ba023f
commit c85c117576
10 changed files with 91 additions and 53 deletions

View File

@@ -6,8 +6,8 @@ For example, you can control the size of the frames captured from the webcam lik
```python
track_constraints = {
"width": {"ideal": 500},
"height": {"ideal": 500},
"width": {"exact": 500},
"height": {"exact": 500},
"frameRate": {"ideal": 30},
}
webrtc = WebRTC(track_constraints=track_constraints,
@@ -16,6 +16,22 @@ webrtc = WebRTC(track_constraints=track_constraints,
```
!!! warning
WebRTC may not enforce your constaints. For example, it may rescale your video
(while keeping the same resolution) in order to maintain the desired (or reach a better) frame rate. If you
really want to enforce height, width and resolution constraints, use the `rtp_params` parameter as set `"degradationPreference": "maintain-resolution"`.
```python
image = WebRTC(
label="Stream",
mode="send",
track_constraints=track_constraints,
rtp_params={"degradationPreference": "maintain-resolution"}
)
```
## The RTC Configuration
You can configure how the connection is created on the client by passing an `rtc_configuration` parameter to the `WebRTC` component constructor.