awacke1's picture
Update app.py
09a2b2a
raw
history blame
748 Bytes
import streamlit as st
import base64
import time
@st.cache_resource
def Base64CacheIt(filename):
# Read the video file as bytes
with open(filename, "rb") as file:
video_bytes = file.read()
# Encode the video bytes as base64
video_base64 = base64.b64encode(video_bytes).decode()
return video_base64
video_placeholder = st.empty()
video_base64 = Base64CacheIt("Walking on Bourbon Street.mp4")
# Create the HTML video element
video_html = f"""
<video autoplay controls>
<source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
Your browser does not support the video element.
</video>
"""
video_placeholder.empty()
time.sleep(1)
video_placeholder.markdown(video_html, unsafe_allow_html=True)