Changing the display size of st.video

I am wondering if there is an option to change the default size of the displayed video?
I am working in normal mode and don’t want the uploaded videos take the whole width of the app when I display them

2 Likes

I also have the same question. Has anyone been able to fix the size of st.video - maybe using CSS markdown hack?

Right now the dimensions of st.video are… too responsive, if there is such a thing :joy:

Hi marduk,
I am also facing similar problem, wondering if you were able to resolve this?

1 Like

Unfortunately no solution yet.

Ideally st.video() would take width and/or height arguments, and an MVP solution would have to be through CSS markdown hack / components.html / components.iframe. Unclear on how to achieve any of this though. Let me know if you figure something out!

Anybody solved this issue. Actually I am looking for resizing the display video

You can somewhat control the width by putting the video widget in a column. This code shows how to use a slider to adjust the width.

import streamlit as st

DEFAULT_WIDTH = 80
VIDEO_DATA = "https://www.youtube.com/watch?v=89LPVXrm_Ic"

st.set_page_config(layout="wide")

width = st.sidebar.slider(
    label="Width", min_value=0, max_value=100, value=DEFAULT_WIDTH, format="%d%%"
)

width = max(width, 0.01)
side = max((100 - width) / 2, 0.01)

_, container, _ = st.columns([side, width, side])
container.video(data=VIDEO_DATA)