File size: 886 Bytes
addff3d
 
 
 
8b502be
 
 
09a2b2a
 
 
 
d10f254
09a2b2a
 
 
911c240
d10f254
53685fc
d10f254
 
 
 
911c240
d10f254
 
 
 
 
addff3d
911c240
 
addff3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import streamlit as st
import base64
import time

# Set page layout to wide screen
st.set_page_config(layout="wide")
#@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()
    
    # Create the HTML video element with looping enabled
    video_html = f"""
    <video autoplay loop controls width="100%">
        <source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
        Your browser does not support the video element.
    </video>
    """
    
    return video_html


video_placeholder = st.empty()
video_html = Base64CacheIt("Walking on Bourbon Street.mp4")

video_placeholder.empty()
time.sleep(1)
video_placeholder.markdown(video_html, unsafe_allow_html=True)