How to adjust height and width of video

i want to adjust height and width of video

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)

Hi @knox

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

More info on st.columns in the Docs page:

Hope this helps!

is there any other method which allows to change height and width

Another hacky approach would be to adjust the CSS parameters of the elements.

More info on how in the FAQ post (see section 3 on CSS styling): FAQ: How to customize the style or appearance of your Streamlit app

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)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.