Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix track_constraints support #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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