diff --git a/src/auracast/multicast.py b/src/auracast/multicast.py
index 55a82fa..ef0303e 100644
--- a/src/auracast/multicast.py
+++ b/src/auracast/multicast.py
@@ -562,11 +562,11 @@ if __name__ == "__main__":
#big.code = 'ff'*16 # returns hci/HCI_ENCRYPTION_MODE_NOT_ACCEPTABLE_ERROR
#big.code = '78 e5 dc f1 34 ab 42 bf c1 92 ef dd 3a fd 67 ae'
big.precode_wav = True
- #big.audio_source = big.audio_source.replace('.wav', '_10_16_32.lc3') #lc3 precoded files
- #big.audio_source = read_lc3_file(big.audio_source) # load files in advance
+ big.audio_source = big.audio_source.replace('.wav', '_10_16_32.lc3') #lc3 precoded files
+ big.audio_source = read_lc3_file(big.audio_source) # load files in advance
# --- Network_uncoded mode using NetworkAudioReceiver ---
- big.audio_source = NetworkAudioReceiverUncoded(port=50007, samplerate=16000, channels=1, chunk_size=1024)
+ #big.audio_source = NetworkAudioReceiverUncoded(port=50007, samplerate=16000, channels=1, chunk_size=1024)
# 16kHz works reliably with 3 streams
# 24kHz is only working with 2 streams - probably airtime constraint
diff --git a/src/auracast/server/multicast_frontend.py b/src/auracast/server/multicast_frontend.py
index 0e45bb3..ed3af61 100644
--- a/src/auracast/server/multicast_frontend.py
+++ b/src/auracast/server/multicast_frontend.py
@@ -1,52 +1,110 @@
# frontend/app.py
+from itertools import filterfalse
import streamlit as st
import requests
+from auracast import auracast_config
# Global: desired packetization time in ms for Opus (should match backend)
PTIME = 40
BACKEND_URL = "http://localhost:5000"
-st.title("๐๏ธ WebRTC mic โ backend demo")
-st.markdown("Click start and speak; watch your backend logs to see incoming RTP.")
+st.title("๐๏ธ Auracast Audio Mode Control")
-component = f"""
-
-
-"""
-st.components.v1.html(component, height=80)
+ try:
+ r = requests.post(f"{BACKEND_URL}/init", json=config.model_dump())
+ if r.status_code == 200:
+ st.success("Stream initialized!")
+ else:
+ st.error(f"Failed to initialize: {r.text}")
+ except Exception as e:
+ st.error(f"Error: {e}")
+
+ if audio_mode == "Webapp":
+ st.markdown("Click start and speak; watch your backend logs to see incoming RTP.")
+ component = f"""
+
+
+ """
+ st.components.v1.html(component, height=80)
+else:
+ st.header("Advertised Streams (Cloud Announcements)")
+ st.info("This feature requires backend support to list advertised streams.")
+ # Placeholder for future implementation
+ # Example: r = requests.get(f"{BACKEND_URL}/advertised_streams")
+ # if r.status_code == 200:
+ # streams = r.json()
+ # for s in streams:
+ # st.write(s)
+ # else:
+ # st.error("Could not fetch advertised streams.")
diff --git a/src/auracast/server/multicast_server.py b/src/auracast/server/multicast_server.py
index be916d9..e11b727 100644
--- a/src/auracast/server/multicast_server.py
+++ b/src/auracast/server/multicast_server.py
@@ -9,7 +9,7 @@ import av
import av.audio.layout
from typing import List, Set
from pydantic import BaseModel
-
+import traceback
app = FastAPI()
@@ -59,6 +59,7 @@ async def initialize(conf: auracast_config.AuracastConfigGroup):
)
await multicaster.init_broadcast()
except Exception as e:
+ log.error("Exception in /init: %s", traceback.format_exc())
raise HTTPException(status_code=500, detail=str(e))
@@ -102,7 +103,7 @@ async def get_status():
}
-PTIME = 40
+PTIME = 160 # TODO: seems to have no effect at all
pcs: Set[RTCPeerConnection] = set() # keep refs so they donโt GC early
class Offer(BaseModel):
@@ -174,7 +175,7 @@ async def shutdown():
if __name__ == '__main__':
import uvicorn
log.basicConfig(
- level=log.INFO,
+ level=log.DEBUG,
format='%(module)s.py:%(lineno)d %(levelname)s: %(message)s'
)
uvicorn.run(app, host="0.0.0.0", port=5000)
\ No newline at end of file