File size: 996 Bytes
2641d32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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.")