import streamlit as st
from streamlit_player import st_player
st.title('Education')
# Sample video dictionary (replace with your video data)
videos = {
"Video 1": "https://youtu.be/3QWjV20zZkQ?t=4",
"Video 2": "https://youtu.be/3QWjV20zZkQ?t=4",
"Video 3": "https://youtu.be/3QWjV20zZkQ?t=4"
}
# Get selected video title from sidebar
selected_video = st.sidebar.selectbox("Select Video", list(videos.keys()))
# Get video path based on selection
video_path = videos[selected_video]
# Display video on main page
st_player(video_path)
Looking at the GitHub repo of the streamlit-player library, it seems there are no parameters to adjust the width/height. Also, it also seems that the width of the player seems to expands to the app’s page width.
To make the width of the player look smaller, you may try putting the player in a column that you create via st.columns
import streamlit as st
video_url = "https://www.youtube.com/watch?v=pyfjbV7K7KE"
col1,col2=st.columns([1,3])
'numbers represent size'
with col1:
st.video(video_url)