Skip to content

Conversation

@bingochaos
Copy link

PR Description

Fixed an issue where track_constraints were not applied in audio-video mode.

Issue

When using track_constraints (either custom or default), the constraints were incorrect. For example:

  webrtc = WebRTC(
            label="Video Chat",
            modality="audio-video",
            mode="send-receive",
            elem_id="video-source",
            track_constraints={
                "video": {
                    "facingMode": "user",
                    "width": {"ideal": 500},
                    "height": {"ideal": 1300},
                    "frameRate": {"ideal": 30},
                },
                "audio": {
                    "echoCancellation": True,
                    "noiseSuppression": {"exact": False},
                    "autoGainControl": {"exact": True},
                    "sampleRate": {"ideal": 24000},
                    "sampleSize": {"ideal": 16},
                    "channelCount": {"exact": 1},
                },
            }
        )

The constraints were not passed through correctly, as shown here:
image

Solution

Resolved the issue by properly deconstructing the track_constraints input. This ensures that both video and audio constraints are now correctly applied.

Fixed an issue where track_constraints does not take effect in the audio-video mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant