Created
February 19, 2024 20:45
-
-
Save iCUE-Solutions/ee4e1e5d6c039fffce2118edd74efefa to your computer and use it in GitHub Desktop.
jump_video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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