YunjinZhang commited on
Commit
c3f5d9b
·
verified ·
1 Parent(s): cb58ada

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. bridge/index.html +42 -5
bridge/index.html CHANGED
@@ -26,7 +26,7 @@
26
  </div></div>
27
  <div id="video-1" class="video-container">
28
  <div class="video-title">1. 0.mp4</div>
29
- <video controls>
30
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/0.mp4?raw=true" type="video/mp4" />
31
  Your browser does not support the video tag.
32
  </video>
@@ -45,7 +45,7 @@
45
  </div></div>
46
  <div id="video-2" class="video-container">
47
  <div class="video-title">2. 1.mp4</div>
48
- <video controls>
49
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/1.mp4?raw=true" type="video/mp4" />
50
  Your browser does not support the video tag.
51
  </video>
@@ -64,7 +64,7 @@
64
  </div></div>
65
  <div id="video-3" class="video-container">
66
  <div class="video-title">3. 2.mp4</div>
67
- <video controls>
68
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/2.mp4?raw=true" type="video/mp4" />
69
  Your browser does not support the video tag.
70
  </video>
@@ -83,7 +83,7 @@
83
  </div></div>
84
  <div id="video-4" class="video-container">
85
  <div class="video-title">4. 3.mp4</div>
86
- <video controls>
87
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/3.mp4?raw=true" type="video/mp4" />
88
  Your browser does not support the video tag.
89
  </video>
@@ -102,7 +102,7 @@
102
  </div></div>
103
  <div id="video-5" class="video-container">
104
  <div class="video-title">5. 4.mp4</div>
105
- <video controls>
106
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/4.mp4?raw=true" type="video/mp4" />
107
  Your browser does not support the video tag.
108
  </video>
@@ -119,5 +119,42 @@
119
  <p>Hold the potato from right edge of the table and place it on above the blue cloth, which is left side of the table.</p>
120
  </div>
121
  </div></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  </body>
123
  </html>
 
26
  </div></div>
27
  <div id="video-1" class="video-container">
28
  <div class="video-title">1. 0.mp4</div>
29
+ <video controls autoplay loop muted>
30
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/0.mp4?raw=true" type="video/mp4" />
31
  Your browser does not support the video tag.
32
  </video>
 
45
  </div></div>
46
  <div id="video-2" class="video-container">
47
  <div class="video-title">2. 1.mp4</div>
48
+ <video controls autoplay loop muted>
49
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/1.mp4?raw=true" type="video/mp4" />
50
  Your browser does not support the video tag.
51
  </video>
 
64
  </div></div>
65
  <div id="video-3" class="video-container">
66
  <div class="video-title">3. 2.mp4</div>
67
+ <video controls autoplay loop muted>
68
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/2.mp4?raw=true" type="video/mp4" />
69
  Your browser does not support the video tag.
70
  </video>
 
83
  </div></div>
84
  <div id="video-4" class="video-container">
85
  <div class="video-title">4. 3.mp4</div>
86
+ <video controls autoplay loop muted>
87
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/3.mp4?raw=true" type="video/mp4" />
88
  Your browser does not support the video tag.
89
  </video>
 
102
  </div></div>
103
  <div id="video-5" class="video-container">
104
  <div class="video-title">5. 4.mp4</div>
105
+ <video controls autoplay loop muted>
106
  <source src="https://huggingface.co/datasets/YunjinZhang/robo_videos/resolve/main/bridge/videos/4.mp4?raw=true" type="video/mp4" />
107
  Your browser does not support the video tag.
108
  </video>
 
119
  <p>Hold the potato from right edge of the table and place it on above the blue cloth, which is left side of the table.</p>
120
  </div>
121
  </div></div>
122
+ <script>
123
+ // This script enables autoplay for all videos when they come into view
124
+ document.addEventListener('DOMContentLoaded', function() {
125
+ const videos = document.querySelectorAll('video');
126
+
127
+ // Function to handle intersection observer callback
128
+ const handleIntersect = (entries, observer) => {
129
+ entries.forEach(entry => {
130
+ // If the video is visible
131
+ if (entry.isIntersecting) {
132
+ const video = entry.target;
133
+ // Start playing
134
+ video.play().catch(e => {
135
+ console.log('Autoplay prevented by browser:', e);
136
+ // We add the muted attribute as a fallback since most browsers allow muted autoplay
137
+ video.muted = true;
138
+ video.play().catch(e => console.log('Even muted autoplay failed:', e));
139
+ });
140
+ } else {
141
+ // When video is not visible, pause it
142
+ entry.target.pause();
143
+ }
144
+ });
145
+ };
146
+
147
+ // Create an Intersection Observer
148
+ const observer = new IntersectionObserver(handleIntersect, {
149
+ root: null, // viewport
150
+ threshold: 0.3 // At least 30% of the video is visible
151
+ });
152
+
153
+ // Observe all videos
154
+ videos.forEach(video => {
155
+ observer.observe(video);
156
+ });
157
+ });
158
+ </script>
159
  </body>
160
  </html>