Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app.py +1 -3
- index.html +16 -2
app.py
CHANGED
|
@@ -86,9 +86,7 @@ stream = Stream(
|
|
| 86 |
additional_outputs_handler=lambda a, b: b,
|
| 87 |
additional_inputs=[chatbot],
|
| 88 |
additional_outputs=[chatbot],
|
| 89 |
-
rtc_configuration=get_twilio_turn_credentials()
|
| 90 |
-
if get_space() == "gradio"
|
| 91 |
-
else None,
|
| 92 |
)
|
| 93 |
|
| 94 |
|
|
|
|
| 86 |
additional_outputs_handler=lambda a, b: b,
|
| 87 |
additional_inputs=[chatbot],
|
| 88 |
additional_outputs=[chatbot],
|
| 89 |
+
rtc_configuration=get_twilio_turn_credentials() if get_space() else None,
|
|
|
|
|
|
|
| 90 |
)
|
| 91 |
|
| 92 |
|
index.html
CHANGED
|
@@ -270,12 +270,26 @@
|
|
| 270 |
const offer = await webrtcPeerConnection.createOffer();
|
| 271 |
await webrtcPeerConnection.setLocalDescription(offer);
|
| 272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
const response = await fetch('/webrtc/offer', {
|
| 274 |
method: 'POST',
|
| 275 |
headers: { 'Content-Type': 'application/json' },
|
| 276 |
body: JSON.stringify({
|
| 277 |
-
sdp:
|
| 278 |
-
type:
|
| 279 |
webrtc_id: webrtcId
|
| 280 |
})
|
| 281 |
});
|
|
|
|
| 270 |
const offer = await webrtcPeerConnection.createOffer();
|
| 271 |
await webrtcPeerConnection.setLocalDescription(offer);
|
| 272 |
|
| 273 |
+
await new Promise((resolve) => {
|
| 274 |
+
if (webrtcPeerConnection.iceGatheringState === "complete") {
|
| 275 |
+
resolve();
|
| 276 |
+
} else {
|
| 277 |
+
const checkState = () => {
|
| 278 |
+
if (webrtcPeerConnection.iceGatheringState === "complete") {
|
| 279 |
+
webrtcPeerConnection.removeEventListener("icegatheringstatechange", checkState);
|
| 280 |
+
resolve();
|
| 281 |
+
}
|
| 282 |
+
};
|
| 283 |
+
webrtcPeerConnection.addEventListener("icegatheringstatechange", checkState);
|
| 284 |
+
}
|
| 285 |
+
});
|
| 286 |
+
|
| 287 |
const response = await fetch('/webrtc/offer', {
|
| 288 |
method: 'POST',
|
| 289 |
headers: { 'Content-Type': 'application/json' },
|
| 290 |
body: JSON.stringify({
|
| 291 |
+
sdp: webrtcPeerConnection.localDescription.sdp,
|
| 292 |
+
type: webrtcPeerConnection.localDescription.type,
|
| 293 |
webrtc_id: webrtcId
|
| 294 |
})
|
| 295 |
});
|