Hi again, @Goyo!!
I think I found out how to deal with it.
*But an observation first: I edited my code above to be more clear and
look alike the answer I came up with.
The idea I had was to delete the widget every time a button is clicked and update the widget based on this interaction. You can see a discussion about deleting widgets here.
I created a placeholder with st.empty()
, and before any update a placeholder.empty()
is performed. This made the use of start_time
possible for subsequent reruns.
import streamlit as st
data = "video.mp4"
st.write("Click to go to that moment in video.")
time_stamps = [
(st.button("Part A", "a"), 1), # bool, moment (seconds)
(st.button("Part B", "b"), 20),
(st.button("Part C", "c"), 40),
]
placeholder = st.empty()
time_chosen = [v for k, v in time_stamps if k == True] # return [int] associated with a clicked button
if time_chosen:
placeholder.empty()
placeholder.video(data, start_time=time_chosen[0])