mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 01:49:23 +08:00
Additional outputs tweaks + fix track constraints (#28)
* code * add code * add code
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user