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)
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.