Hello, please im working on this project using streamlit ! i have the buckend server where i receive from the audio data! then i transoform it to base64 and play it with pygame,
@sio.event
def audio(data):
try:
audio_bytes = base64.b64decode(data[‘audio’])
audio_buffer = BytesIO(audio_bytes)
pygame.mixer.music.load(audio_buffer)
pygame.mixer.music.play()
print(“Playing audio response…”)
except Exception as e:
print(f"Error playing audio: {e}")
if st.button("Say hello"):
sio.connect('http://localhost:5000')
print("connetcted")
sio.emit('start_transcription')
please how to play the audio using streamlit ? i want it to be played in the UI
i did try to use
audio_bytes = base64.b64decode(data[‘audio’])
st.audio(audio_bytes, format=“audio/wav”)
print(“audio playing”)
here’s what i got
2025-04-20 17:07:47.004 Thread ‘Thread-10 (_handle_eio_message)’: missing ScriptRunContext
2025-04-20 17:07:47.005 Thread ‘Thread-10 (_handle_eio_message)’: missing ScriptRunContext
2025-04-20 17:07:47.005 Thread ‘Thread-10 (_handle_eio_message)’: missing ScriptRunContext
Playing audio response…