Update app.py
Browse files
app.py
CHANGED
@@ -7,20 +7,25 @@ def Base64CacheIt(filename):
|
|
7 |
# Read the video file as bytes
|
8 |
with open(filename, "rb") as file:
|
9 |
video_bytes = file.read()
|
|
|
10 |
# Encode the video bytes as base64
|
11 |
video_base64 = base64.b64encode(video_bytes).decode()
|
12 |
-
return video_base64
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
""
|
24 |
|
25 |
video_placeholder.empty()
|
26 |
time.sleep(1)
|
|
|
7 |
# Read the video file as bytes
|
8 |
with open(filename, "rb") as file:
|
9 |
video_bytes = file.read()
|
10 |
+
|
11 |
# Encode the video bytes as base64
|
12 |
video_base64 = base64.b64encode(video_bytes).decode()
|
|
|
13 |
|
14 |
+
# Create the HTML video element
|
15 |
+
video_html = f"""
|
16 |
+
<video autoplay controls width="100%">
|
17 |
+
<source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
|
18 |
+
Your browser does not support the video element.
|
19 |
+
</video>
|
20 |
+
"""
|
21 |
|
22 |
+
return video_html
|
23 |
+
|
24 |
+
# Set page layout to wide screen
|
25 |
+
st.set_page_config(layout="wide")
|
26 |
+
|
27 |
+
video_placeholder = st.empty()
|
28 |
+
video_html = Base64CacheIt("Walking on Bourbon Street.mp4")
|
29 |
|
30 |
video_placeholder.empty()
|
31 |
time.sleep(1)
|