Skip to content

Commit fa28f1e

Browse files
committed
undo video optmiz
1 parent 8392bac commit fa28f1e

File tree

2 files changed

+0
-43
lines changed

2 files changed

+0
-43
lines changed

themes/Begrip/static/css/index.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@
122122
display: block;
123123
object-fit: cover;
124124
background-color: #0f2c06;
125-
transform: translateZ(0);
126-
backface-visibility: hidden;
127125
}
128126

129127
#heading-container .container-left p {

themes/Begrip/static/js/script.js

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -44,53 +44,12 @@ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
4444

4545
document.addEventListener("DOMContentLoaded", function() {
4646
const heroVideo = document.querySelector("#heading-container .hero-video");
47-
const heroSection = document.querySelector("#heading-container");
48-
const isMobileViewport = window.matchMedia("(max-width: 900px)").matches;
49-
50-
function safePlayVideo(videoEl) {
51-
if (!videoEl) {
52-
return;
53-
}
54-
const playPromise = videoEl.play();
55-
if (playPromise && typeof playPromise.catch === "function") {
56-
playPromise.catch(function() {
57-
// Ignore autoplay interruptions from browser policies.
58-
});
59-
}
60-
}
61-
6247
if (heroVideo) {
6348
heroVideo.addEventListener("loadedmetadata", function() {
6449
heroVideo.currentTime = 5.5;
6550
}, { once: true });
6651
}
6752

68-
if (heroVideo && heroSection && isMobileViewport && "IntersectionObserver" in window) {
69-
let heroIsVisible = true;
70-
const observer = new IntersectionObserver(function(entries) {
71-
entries.forEach(function(entry) {
72-
heroIsVisible = entry.isIntersecting && entry.intersectionRatio >= 0.18;
73-
});
74-
if (heroIsVisible) {
75-
safePlayVideo(heroVideo);
76-
} else {
77-
heroVideo.pause();
78-
}
79-
}, {
80-
threshold: [0, 0.18, 0.4]
81-
});
82-
83-
observer.observe(heroSection);
84-
85-
document.addEventListener("visibilitychange", function() {
86-
if (document.hidden) {
87-
heroVideo.pause();
88-
} else if (heroIsVisible) {
89-
safePlayVideo(heroVideo);
90-
}
91-
});
92-
}
93-
9453
const heroIntroTargets = document.querySelectorAll([
9554
"#heading-container .container-left img",
9655
"#heading-container .container-left p",

0 commit comments

Comments
 (0)