tonyassi commited on
Commit
4dadbe6
·
verified ·
1 Parent(s): bcccbd8

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +61 -0
index.html ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Icon Button Video Selector</title>
7
+ <style>
8
+ .icon-button {
9
+ cursor: pointer;
10
+ border: none;
11
+ background: none;
12
+ padding: 10px;
13
+ }
14
+ .icon-button img {
15
+ width: 50px; /* Adjust the size as needed */
16
+ height: auto;
17
+ }
18
+ </style>
19
+ </head>
20
+ <body>
21
+ <div>
22
+ <button class="icon-button" onclick="showVideo('https://huggingface.co/spaces/tonyassi/g/resolve/main/lucy/video1.mov')">
23
+ <img src="https://huggingface.co/spaces/tonyassi/g/resolve/main/icon/fish.png" alt="Fish Icon">
24
+ </button>
25
+ <button class="icon-button" onclick="showVideo('https://huggingface.co/spaces/tonyassi/g/resolve/main/lucy/video2.mov')">
26
+ <img src="https://huggingface.co/spaces/tonyassi/g/resolve/main/icon/david.png" alt="David Icon">
27
+ </button>
28
+ </div>
29
+
30
+ <div id="videoContainer" style="margin-top: 20px; display: none;">
31
+ <video id="videoPlayer" width="600" controls loop>
32
+ <source id="videoSource" src="" type="video/mp4">
33
+ Your browser does not support the video tag.
34
+ </video>
35
+ </div>
36
+
37
+ <script>
38
+ function showVideo(videoUrl) {
39
+ const videoContainer = document.getElementById('videoContainer');
40
+ const videoPlayer = document.getElementById('videoPlayer');
41
+ const videoSource = document.getElementById('videoSource');
42
+
43
+ videoSource.src = videoUrl;
44
+ videoPlayer.load();
45
+ videoPlayer.play();
46
+ videoContainer.style.display = 'block'; // Show the video container
47
+ }
48
+
49
+ // Add event listeners for focus and blur to detect fullscreen exit
50
+ const videoPlayer = document.getElementById('videoPlayer');
51
+ videoPlayer.addEventListener('webkitendfullscreen', hideVideoOnExit); // Specific to iOS Safari
52
+ videoPlayer.addEventListener('pause', hideVideoOnExit); // Additional fallback for mobile
53
+ videoPlayer.addEventListener('ended', hideVideoOnExit); // Hide when video ends (optional)
54
+
55
+ function hideVideoOnExit() {
56
+ const videoContainer = document.getElementById('videoContainer');
57
+ videoContainer.style.display = 'none'; // Hide the video container
58
+ }
59
+ </script>
60
+ </body>
61
+ </html>