mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-04 17:39:23 +08:00
fixes (#145)
This commit is contained in:
@@ -183,7 +183,7 @@ class Stream(WebRTCConnectionMixin):
|
||||
if component in additional_output_components
|
||||
]
|
||||
for component in additional_output_components:
|
||||
if component not in same_components:
|
||||
if component in same_components:
|
||||
same_components.append(component)
|
||||
if self.modality == "video" and self.mode == "receive":
|
||||
with gr.Blocks() as demo:
|
||||
@@ -230,6 +230,7 @@ class Stream(WebRTCConnectionMixin):
|
||||
assert self.additional_outputs_handler
|
||||
output_video.on_additional_outputs(
|
||||
self.additional_outputs_handler,
|
||||
inputs=additional_output_components,
|
||||
outputs=additional_output_components,
|
||||
)
|
||||
elif self.modality == "video" and self.mode == "send":
|
||||
@@ -275,6 +276,7 @@ class Stream(WebRTCConnectionMixin):
|
||||
assert self.additional_outputs_handler
|
||||
output_video.on_additional_outputs(
|
||||
self.additional_outputs_handler,
|
||||
inputs=additional_output_components,
|
||||
outputs=additional_output_components,
|
||||
)
|
||||
elif self.modality == "video" and self.mode == "send-receive":
|
||||
|
||||
@@ -36,14 +36,6 @@
|
||||
stop: undefined;
|
||||
}>();
|
||||
|
||||
onMount(() => {
|
||||
window.setInterval(() => {
|
||||
if (stream_state == "open") {
|
||||
dispatch("tick");
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
async function start_stream(value: string): Promise<string> {
|
||||
if (value === "start_webrtc_stream") {
|
||||
stream_state = "waiting";
|
||||
@@ -55,6 +47,7 @@
|
||||
case "connected":
|
||||
console.info("connected");
|
||||
stream_state = "open";
|
||||
dispatch("tick");
|
||||
break;
|
||||
case "disconnected":
|
||||
console.info("closed");
|
||||
|
||||
@@ -27,14 +27,6 @@
|
||||
|
||||
let stream_state = "closed";
|
||||
|
||||
onMount(() => {
|
||||
window.setInterval(() => {
|
||||
if (stream_state == "open") {
|
||||
dispatch("tick");
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
$: if (value === "start_webrtc_stream") {
|
||||
_webrtc_id = Math.random().toString(36).substring(2);
|
||||
value = _webrtc_id;
|
||||
@@ -43,6 +35,7 @@
|
||||
switch (pc.connectionState) {
|
||||
case "connected":
|
||||
stream_state = "open";
|
||||
dispatch("tick");
|
||||
break;
|
||||
case "disconnected":
|
||||
stop(pc);
|
||||
|
||||
Reference in New Issue
Block a user