Troubleshoot audio error

The audio component find the local file(s) and the player bar appears but it says “Error”. I’m not sure how to troubleshoot this.

audio_file = open("Media/audio/voyages.ogg", 'rb')
audio_bytes = audio_file.read()
st.audio(audio_bytes, format='audio/ogg',start_time=0)

I’ve tried mp3 and ogg formats with file sizes ranging 2.7MB - 9MB. For the format I tried putting both format=‘audio/ogg’ and format=‘audio/mp3’ although I’m not sure if the latter is even supported (it’s not mentioned by the docs but in various posts I’ve seem some people do it…).

On a related note, if there’s a way to add arbitrary non-streamlit code / embeds to an app like in Shiny that would be really powerful, so please let me know. For instance, what I’d really like to do is embed a stream from SoundCloud.com using their code.

Regarding arbitrary code, here’s my updated understanding and please correct me if I’m wrong:

  1. There’s st.code() but it’s very limited
  2. The other route would be to create your own “Custom Component”?

#2 is probably the way to go but it sounds hard offhand. It’s probably not. I was just hoping I could copy and paste some embed code from various Internet services.