Audio file with ranger slide

Has anyone created audio file play with ranger slide?

Hey @sadia_ewu, welcome to our community - great to have you! :hugs:

I can try to find some examples, but would you mind being a bit more precise about what you are after, please? :slight_smile:

Thanks,
Charly

Are you looking for something like this?

import streamlit as st

url = "https://freetestdata.com/wp-content/uploads/2021/09/Free_Test_Data_1MB_MP3.mp3"

length = 43  # in seconds

start_time = st.slider("Start Time", 0, length, 0)

st.audio(url, start_time=start_time, autoplay=True)
1 Like

hi, Sorry for not being precise.
I have already shown the .wav file with st.audio function.
I was wondering can er put the st.select_slider type of thing on the audio player itself?
Pretty much like the attached image
image

Nope, I’m afraid not – you can use st.slider to select a range to play from the audio, like this

start_time, end_time = st.slider("Select audio range", 0, length, (0, length))

st.audio(url, start_time=start_time, end_time=end_time, autoplay=True)

But the st.audio player uses the standard audio component that’s built into the browser, and there’s no range picker built into that <audio>: The Embed Audio element - HTML: HyperText Markup Language | MDN

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.