Fix
Browse files
main.py
CHANGED
@@ -19,13 +19,6 @@ aiortc_rtcrtpsender_logger.setLevel(logging.INFO)
|
|
19 |
frontend_ice_type = st.selectbox("Frontend ICE type", ["Empty", "Google STUN", "Twilio STUN/TURN", "Twilio STUN/TURN and Google STUN", "HF TURN only", "HF TURN and Google STUN", "None configured"])
|
20 |
backend_ice_type = st.selectbox("Backend ICE type", ["Empty", "Google STUN", "Twilio STUN/TURN", "Twilio STUN/TURN and Google STUN", "HF TURN only", "HF TURN and Google STUN", "None configured"])
|
21 |
|
22 |
-
TWILIO_ICE_SERVERS = get_twilio_ice_servers(
|
23 |
-
twilio_sid=st.secrets["TWILIO_ACCOUNT_SID"],
|
24 |
-
twilio_token=st.secrets["TWILIO_AUTH_TOKEN"],
|
25 |
-
)
|
26 |
-
|
27 |
-
HF_ICE_SERVERS = get_hf_ice_servers(token=st.secrets["HF_TOKEN"])
|
28 |
-
|
29 |
# google_stun_ice_servers = [{"urls": ["stun:stun.l.google.com:19302"]}]
|
30 |
google_stun_ice_servers = [{"urls": "stun:stun.l.google.com:19302", "url": "stun:stun.l.google.com:19302"}]
|
31 |
|
@@ -39,19 +32,25 @@ elif frontend_ice_type == "Google STUN":
|
|
39 |
}
|
40 |
elif frontend_ice_type == "Twilio STUN/TURN":
|
41 |
frontend_rtc_configuration = {
|
42 |
-
"iceServers":
|
|
|
|
|
|
|
43 |
}
|
44 |
elif frontend_ice_type == "Twilio STUN/TURN and Google STUN":
|
45 |
frontend_rtc_configuration = {
|
46 |
-
"iceServers": google_stun_ice_servers +
|
|
|
|
|
|
|
47 |
}
|
48 |
elif frontend_ice_type == "HF TURN only":
|
49 |
frontend_rtc_configuration = {
|
50 |
-
"iceServers":
|
51 |
}
|
52 |
elif frontend_ice_type == "HF TURN and Google STUN":
|
53 |
frontend_rtc_configuration = {
|
54 |
-
"iceServers":
|
55 |
}
|
56 |
elif frontend_ice_type == "None configured":
|
57 |
frontend_rtc_configuration = None
|
@@ -66,19 +65,25 @@ elif backend_ice_type == "Google STUN":
|
|
66 |
}
|
67 |
elif backend_ice_type == "Twilio STUN/TURN":
|
68 |
backend_rtc_configuration = {
|
69 |
-
"iceServers":
|
|
|
|
|
|
|
70 |
}
|
71 |
elif backend_ice_type == "Twilio STUN/TURN and Google STUN":
|
72 |
backend_rtc_configuration = {
|
73 |
-
"iceServers": google_stun_ice_servers +
|
|
|
|
|
|
|
74 |
}
|
75 |
elif backend_ice_type == "HF TURN only":
|
76 |
backend_rtc_configuration = {
|
77 |
-
"iceServers":
|
78 |
}
|
79 |
elif backend_ice_type == "HF TURN and Google STUN":
|
80 |
backend_rtc_configuration = {
|
81 |
-
"iceServers":
|
82 |
}
|
83 |
elif backend_ice_type == "None configured":
|
84 |
backend_rtc_configuration = None
|
|
|
19 |
frontend_ice_type = st.selectbox("Frontend ICE type", ["Empty", "Google STUN", "Twilio STUN/TURN", "Twilio STUN/TURN and Google STUN", "HF TURN only", "HF TURN and Google STUN", "None configured"])
|
20 |
backend_ice_type = st.selectbox("Backend ICE type", ["Empty", "Google STUN", "Twilio STUN/TURN", "Twilio STUN/TURN and Google STUN", "HF TURN only", "HF TURN and Google STUN", "None configured"])
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
# google_stun_ice_servers = [{"urls": ["stun:stun.l.google.com:19302"]}]
|
23 |
google_stun_ice_servers = [{"urls": "stun:stun.l.google.com:19302", "url": "stun:stun.l.google.com:19302"}]
|
24 |
|
|
|
32 |
}
|
33 |
elif frontend_ice_type == "Twilio STUN/TURN":
|
34 |
frontend_rtc_configuration = {
|
35 |
+
"iceServers": get_twilio_ice_servers(
|
36 |
+
twilio_sid=st.secrets["TWILIO_ACCOUNT_SID"],
|
37 |
+
twilio_token=st.secrets["TWILIO_AUTH_TOKEN"],
|
38 |
+
)
|
39 |
}
|
40 |
elif frontend_ice_type == "Twilio STUN/TURN and Google STUN":
|
41 |
frontend_rtc_configuration = {
|
42 |
+
"iceServers": google_stun_ice_servers + get_twilio_ice_servers(
|
43 |
+
twilio_sid=st.secrets["TWILIO_ACCOUNT_SID"],
|
44 |
+
twilio_token=st.secrets["TWILIO_AUTH_TOKEN"],
|
45 |
+
)
|
46 |
}
|
47 |
elif frontend_ice_type == "HF TURN only":
|
48 |
frontend_rtc_configuration = {
|
49 |
+
"iceServers": get_hf_ice_servers(token=st.secrets["HF_TOKEN"])
|
50 |
}
|
51 |
elif frontend_ice_type == "HF TURN and Google STUN":
|
52 |
frontend_rtc_configuration = {
|
53 |
+
"iceServers": get_hf_ice_servers(token=st.secrets["HF_TOKEN"]) + google_stun_ice_servers
|
54 |
}
|
55 |
elif frontend_ice_type == "None configured":
|
56 |
frontend_rtc_configuration = None
|
|
|
65 |
}
|
66 |
elif backend_ice_type == "Twilio STUN/TURN":
|
67 |
backend_rtc_configuration = {
|
68 |
+
"iceServers": get_twilio_ice_servers(
|
69 |
+
twilio_sid=st.secrets["TWILIO_ACCOUNT_SID"],
|
70 |
+
twilio_token=st.secrets["TWILIO_AUTH_TOKEN"],
|
71 |
+
)
|
72 |
}
|
73 |
elif backend_ice_type == "Twilio STUN/TURN and Google STUN":
|
74 |
backend_rtc_configuration = {
|
75 |
+
"iceServers": google_stun_ice_servers + get_twilio_ice_servers(
|
76 |
+
twilio_sid=st.secrets["TWILIO_ACCOUNT_SID"],
|
77 |
+
twilio_token=st.secrets["TWILIO_AUTH_TOKEN"],
|
78 |
+
) + google_stun_ice_servers
|
79 |
}
|
80 |
elif backend_ice_type == "HF TURN only":
|
81 |
backend_rtc_configuration = {
|
82 |
+
"iceServers": get_hf_ice_servers(token=st.secrets["HF_TOKEN"])
|
83 |
}
|
84 |
elif backend_ice_type == "HF TURN and Google STUN":
|
85 |
backend_rtc_configuration = {
|
86 |
+
"iceServers": get_hf_ice_servers(token=st.secrets["HF_TOKEN"]) + google_stun_ice_servers
|
87 |
}
|
88 |
elif backend_ice_type == "None configured":
|
89 |
backend_rtc_configuration = None
|