reder refresh button even if no mic was present
This commit is contained in:
@@ -69,24 +69,29 @@ if audio_mode in ["Webapp", "USB"]:
|
|||||||
input_options = []
|
input_options = []
|
||||||
|
|
||||||
if not input_options:
|
if not input_options:
|
||||||
st.error("No hardware audio input devices found.")
|
st.warning("No hardware audio input devices found. Plug in a USB input device and click Refresh.")
|
||||||
st.stop()
|
|
||||||
|
|
||||||
if default_input not in input_options:
|
|
||||||
default_input = input_options[0]
|
|
||||||
|
|
||||||
col1, col2 = st.columns([3, 1], vertical_alignment="bottom")
|
|
||||||
with col1:
|
|
||||||
selected_option = st.selectbox("Input Device", input_options, index=input_options.index(default_input))
|
|
||||||
with col2:
|
|
||||||
if st.button("Refresh"):
|
if st.button("Refresh"):
|
||||||
try:
|
try:
|
||||||
requests.post(f"{BACKEND_URL}/refresh_audio_inputs", timeout=3)
|
requests.post(f"{BACKEND_URL}/refresh_audio_inputs", timeout=3)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
st.error(f"Failed to refresh devices: {e}")
|
st.error(f"Failed to refresh devices: {e}")
|
||||||
st.rerun()
|
st.rerun()
|
||||||
# We send only the numeric/card identifier (before :) or 'default'
|
input_device = None
|
||||||
input_device = selected_option.split(":", 1)[0] if ":" in selected_option else selected_option
|
else:
|
||||||
|
if default_input not in input_options:
|
||||||
|
default_input = input_options[0]
|
||||||
|
col1, col2 = st.columns([3, 1], vertical_alignment="bottom")
|
||||||
|
with col1:
|
||||||
|
selected_option = st.selectbox("Input Device", input_options, index=input_options.index(default_input))
|
||||||
|
with col2:
|
||||||
|
if st.button("Refresh"):
|
||||||
|
try:
|
||||||
|
requests.post(f"{BACKEND_URL}/refresh_audio_inputs", timeout=3)
|
||||||
|
except Exception as e:
|
||||||
|
st.error(f"Failed to refresh devices: {e}")
|
||||||
|
st.rerun()
|
||||||
|
# We send only the numeric/card identifier (before :) or 'default'
|
||||||
|
input_device = selected_option.split(":", 1)[0] if ":" in selected_option else selected_option
|
||||||
else:
|
else:
|
||||||
input_device = None
|
input_device = None
|
||||||
start_stream = st.button("Start Auracast")
|
start_stream = st.button("Start Auracast")
|
||||||
|
|||||||
Reference in New Issue
Block a user