Skip to content

Commit 030e540

Browse files
committed
Changes
1 parent f64217f commit 030e540

File tree

322 files changed

+3569
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+3569
-40
lines changed

_site/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ <h2 class="title is-4 publication-title is-size-4-mobile" style="color: white; m
7676
</a>
7777
</span>
7878
<span class="link-block">
79-
<a href="https://genrobo.github.io/DreamControl/" target="_blank"
79+
<a href="https://github.com/GenRobo/DreamControl/tree/main" target="_blank"
8080
class="external-link button is-normal is-rounded">
8181
<span class="icon">
8282
<i class="fab fa-github fa-lg"></i>
8383
</span>
84-
<span>Code (Coming Soon)</span>
84+
<span>Code</span>
8585
</a>
8686
</span>
8787

@@ -290,7 +290,7 @@ <h2 class="title is-3 has-text-centered">Skills deployed on hardware</h2>
290290
type="video/mp4">
291291
</video>
292292
<h10 class="subtitle is-4 has-text-centered">
293-
"Open microwave"
293+
"Start microwave"
294294
</h10>
295295
</div>
296296
<div class="item item-video3">
@@ -300,7 +300,7 @@ <h2 class="title is-3 has-text-centered">Skills deployed on hardware</h2>
300300
type="video/mp4">
301301
</video>
302302
<h10 class="subtitle is-4 has-text-centered">
303-
"Start microwave"
303+
"Open microwave"
304304
</h10>
305305
</div>
306306
<div class="item item-video2">

_site/static/js/index.js

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,61 @@ $(document).ready(function() {
6767
} else {
6868
console.log('Background video not found!');
6969
}
70-
// Handle carousel videos autoplay
70+
// Optimize carousel videos: only play when sufficiently visible (desktop only)
7171
var carouselVideos = document.querySelectorAll('.carousel video');
72-
carouselVideos.forEach(function(video) {
73-
console.log('Processing video, autoplay:', autoplay);
74-
if (autoplay) {
75-
video.setAttribute('autoplay', '');
76-
video.setAttribute('preload', 'auto'); // Change from 'none' to 'auto' for autoplay to work
77-
console.log('Added autoplay to video and set preload to auto');
78-
79-
// Try to play the video programmatically as a fallback
80-
video.play().then(function() {
81-
console.log('Video started playing successfully');
82-
}).catch(function(error) {
83-
console.log('Autoplay failed:', error);
72+
73+
if (!isMobile) {
74+
// Desktop behavior: play/pause based on visibility
75+
carouselVideos.forEach(function(video) {
76+
video.muted = true;
77+
video.removeAttribute('autoplay');
78+
video.setAttribute('preload', 'metadata');
79+
});
80+
81+
var visibilityObserver = new IntersectionObserver(function(entries) {
82+
entries.forEach(function(entry) {
83+
var video = entry.target;
84+
var isVisible = entry.isIntersecting && entry.intersectionRatio >= 0.6;
85+
86+
if (isVisible) {
87+
video.setAttribute('preload', 'auto');
88+
89+
var carouselRoot = video.closest('.carousel');
90+
if (carouselRoot) {
91+
carouselRoot.querySelectorAll('video').forEach(function(sibling) {
92+
if (sibling !== video && !sibling.paused) {
93+
try { sibling.pause(); } catch (e) { /* no-op */ }
94+
}
95+
});
96+
}
97+
98+
video.play().catch(function() { /* Autoplay might be blocked; ignore */ });
99+
} else {
100+
try { video.pause(); } catch (e) { /* no-op */ }
101+
}
84102
});
85-
} else {
103+
}, { threshold: [0, 0.25, 0.5, 0.6, 0.75, 1] });
104+
105+
carouselVideos.forEach(function(video) {
106+
visibilityObserver.observe(video);
107+
});
108+
109+
document.addEventListener('visibilitychange', function() {
110+
if (document.hidden) {
111+
document.querySelectorAll('.carousel video').forEach(function(video) {
112+
try { video.pause(); } catch (e) { /* no-op */ }
113+
});
114+
}
115+
});
116+
} else {
117+
// Mobile behavior: never autoplay, keep minimal preload, ensure paused
118+
carouselVideos.forEach(function(video) {
119+
video.muted = true;
86120
video.removeAttribute('autoplay');
87-
video.setAttribute('preload', 'none'); // Keep preload as 'none' when no autoplay
88-
console.log('Removed autoplay from video and set preload to none');
89-
}
90-
});
121+
video.setAttribute('preload', 'none');
122+
// try { video.pause(); } catch (e) { /* no-op */ }
123+
});
124+
}
91125

92126
// Loop on each carousel initialized
93127
// for(var i = 0; i < carousels.length; i++) {
4.12 MB
Loading

static/_site/css/bulma-carousel.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)