mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
* Allow extra tracks (#231) * Add allow_extra_tracks to WebRTC component --------- Co-authored-by: Marcus Valtonen Örnhag <marcus.valtonen.ornhag@ericsson.com>
This commit is contained in:
committed by
GitHub
parent
e89f0699b5
commit
aed34825e3
@@ -81,6 +81,7 @@ class WebRTCConnectionMixin:
|
||||
self.time_limit: float | None
|
||||
self.modality: Literal["video", "audio", "audio-video"]
|
||||
self.mode: Literal["send", "receive", "send-receive"]
|
||||
self.allow_extra_tracks: bool
|
||||
|
||||
@staticmethod
|
||||
async def wait_for_time_limit(pc: RTCPeerConnection, time_limit: float):
|
||||
@@ -329,6 +330,8 @@ class WebRTCConnectionMixin:
|
||||
if self.modality not in ["video", "audio", "audio-video"]:
|
||||
msg = "Modality must be either video, audio, or audio-video"
|
||||
else:
|
||||
if self.allow_extra_tracks:
|
||||
return
|
||||
msg = f"Unsupported track kind '{track.kind}' for modality '{self.modality}'"
|
||||
raise ValueError(msg)
|
||||
if body["webrtc_id"] not in self.connections:
|
||||
|
||||
Reference in New Issue
Block a user