tonyassi commited on
Commit
29878d5
·
verified ·
1 Parent(s): 891c9ec

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +54 -0
index.html ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Dropdown Video Selector</title>
7
+ </head>
8
+ <body>
9
+ <label for="videoSelect">Choose a video:</label>
10
+ <select id="videoSelect" onchange="changeVideo()">
11
+ <option value="">--Select a video--</option>
12
+ <option value="https://huggingface.co/spaces/tonyassi/g/resolve/main/lucy/video1.mov">Video 1</option>
13
+ <option value="https://huggingface.co/spaces/tonyassi/g/resolve/main/lucy/video2.mov">Video 2</option>
14
+ </select>
15
+
16
+ <div id="videoContainer" style="margin-top: 20px; display: none;">
17
+ <video id="videoPlayer" width="600" controls loop>
18
+ <source id="videoSource" src="" type="video/mp4">
19
+ Your browser does not support the video tag.
20
+ </video>
21
+ </div>
22
+
23
+ <script>
24
+ function changeVideo() {
25
+ const videoSelect = document.getElementById('videoSelect');
26
+ const videoContainer = document.getElementById('videoContainer');
27
+ const videoPlayer = document.getElementById('videoPlayer');
28
+ const videoSource = document.getElementById('videoSource');
29
+
30
+ const selectedValue = videoSelect.value;
31
+ if (selectedValue) {
32
+ videoSource.src = selectedValue;
33
+ videoPlayer.load();
34
+ videoPlayer.play();
35
+ videoContainer.style.display = 'block'; // Show the video container
36
+ } else {
37
+ videoContainer.style.display = 'none'; // Hide the video container if no video is selected
38
+ }
39
+ }
40
+
41
+ // Event listener for fullscreen change
42
+ document.addEventListener('fullscreenchange', () => {
43
+ const videoContainer = document.getElementById('videoContainer');
44
+ const videoPlayer = document.getElementById('videoPlayer');
45
+
46
+ // Check if exiting fullscreen mode
47
+ if (!document.fullscreenElement && videoPlayer.readyState >= 2) {
48
+ videoContainer.style.display = 'none'; // Hide the video container
49
+ videoPlayer.pause(); // Pause the video
50
+ }
51
+ });
52
+ </script>
53
+ </body>
54
+ </html>