Can streamlit display video from Google Drive, instead of mp4 from where the code resides?

Hi there :wave:, I won’t be able to check my video into github due to its size so I am thinking of other ways to make my video available for display from streamlit. One option I thought of is to upload the video to google drive but the problem is I can’t use the open() call to open up the link.

my_file = “https://drive.google.com/file
video_file = open(my_file, “rb”).read()
show_topics.video(video_file)

Does anyone know how I could make st.video() work with videos on Google Drive? Thank you!

Hi @dashboard -

You’re right, this won’t work because open is a filesystem command, but having the file anywhere else requires a download first. You can do a download using the requests library or similar, but you’ll have increased latency as you wait for the whole video to download.

Once you do download the bytes, then using st.video should work. And depending on what you are trying to do, you could host the video on YouTube or similar (if you’re just trying to display the video)

Best,
Randy

Thank you so much @randyzwitch for the guidance. I think in that case Drive is not the right option as the experience will not be too pleasant for users. I will look for other options.