Hackerytboy commited on
Commit
bec3444
·
verified ·
1 Parent(s): 4aab70a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ def video_player():
5
+ # Fetch quality links from Flask backend
6
+ try:
7
+ response = requests.get("http://127.0.0.1:7860/get_links")
8
+ response.raise_for_status()
9
+ links = response.json()
10
+ except Exception as e:
11
+ return f"Error fetching video links: {e}"
12
+
13
+ # HTML for Video.js player
14
+ video_html = f"""
15
+ <video id="video-player" class="video-js vjs-default-skin" controls autoplay width="800" height="450">
16
+ <source src="{links['720']}" type="application/x-mpegURL">
17
+ </video>
18
+ <script src="https://vjs.zencdn.net/8.3.0/video.min.js"></script>
19
+ <script>
20
+ const player = videojs('video-player');
21
+ player.play();
22
+ </script>
23
+ """
24
+
25
+ return gr.HTML(video_html)
26
+
27
+ # Gradio interface
28
+ demo = gr.Interface(
29
+ fn=video_player,
30
+ inputs=[],
31
+ outputs="html",
32
+ title="Professional HLS Player"
33
+ )
34
+
35
+ if __name__ == "__main__":
36
+ demo.launch(server_name="0.0.0.0", server_port=7861)