Skip to content

Instantly share code, notes, and snippets.

@iCUE-Solutions
Created February 19, 2024 20:45
Show Gist options
  • Save iCUE-Solutions/ee4e1e5d6c039fffce2118edd74efefa to your computer and use it in GitHub Desktop.
Save iCUE-Solutions/ee4e1e5d6c039fffce2118edd74efefa to your computer and use it in GitHub Desktop.
jump_video
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])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment