Spaces:
Running on Zero
Running on Zero
Commit ·
b68901c
1
Parent(s): 3ed8155
Apply TURN relay to both WebRTC peers
Browse files- streaming_app.py +5 -0
streaming_app.py
CHANGED
|
@@ -222,6 +222,11 @@ async def get_turn_configuration():
|
|
| 222 |
hf_token=token,
|
| 223 |
ttl=TURN_TOKEN_TTL_SECONDS,
|
| 224 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
clear_turn_token()
|
| 226 |
return configuration
|
| 227 |
|
|
|
|
| 222 |
hf_token=token,
|
| 223 |
ttl=TURN_TOKEN_TTL_SECONDS,
|
| 224 |
)
|
| 225 |
+
# The browser and the aiortc server are both behind NAT/firewall boundaries
|
| 226 |
+
# on Spaces. Give the server peer the same short-lived relay configuration
|
| 227 |
+
# before the browser sends its SDP offer.
|
| 228 |
+
webrtc.server_rtc_configuration = WebRTC.convert_to_aiortc_format(configuration)
|
| 229 |
+
print("Applied temporary TURN relay configuration to both WebRTC peers.")
|
| 230 |
clear_turn_token()
|
| 231 |
return configuration
|
| 232 |
|