Student3331's picture
Create app.py
2641d32 verified
Raw History Blame Contribute Delete
996 Bytes
import streamlit as st
import cv2
import numpy as np
# Create a simple Streamlit app for video player
st.title("AI Video Player")
# Create an open button to allow users to paste the video URL
open_url = st.text_input("Paste Video URL Here:")
# If a URL is provided, show the play button
if open_url:
play_button = st.button("Play Video")
# Play the video when the play button is clicked
if play_button:
st.video(open_url, format="video/mp4", start_time=0)
# Control play/pause via buttons (since Streamlit doesn't have native support for play/pause)
pause_button = st.button("Pause Video")
if pause_button:
# Create a logic to pause the video by clearing and restarting (this can be improved)
st.empty()
st.write("Video Paused. Click Play again to resume.")
else:
st.write("Video is playing.")
# Else prompt user to open a URL
else:
st.write("Please paste a URL to start.")