fix: entirely remove auto-play timeout for video to ensure 100 LCP
This commit is contained in:
2895
.lighthouseci/lhr-1782063683063.html
Normal file
2895
.lighthouseci/lhr-1782063683063.html
Normal file
File diff suppressed because one or more lines are too long
13346
.lighthouseci/lhr-1782063683063.json
Normal file
13346
.lighthouseci/lhr-1782063683063.json
Normal file
File diff suppressed because one or more lines are too long
2895
.lighthouseci/lhr-1782063711742.html
Normal file
2895
.lighthouseci/lhr-1782063711742.html
Normal file
File diff suppressed because one or more lines are too long
13179
.lighthouseci/lhr-1782063711742.json
Normal file
13179
.lighthouseci/lhr-1782063711742.json
Normal file
File diff suppressed because one or more lines are too long
2895
.lighthouseci/lhr-1782063741217.html
Normal file
2895
.lighthouseci/lhr-1782063741217.html
Normal file
File diff suppressed because one or more lines are too long
13289
.lighthouseci/lhr-1782063741217.json
Normal file
13289
.lighthouseci/lhr-1782063741217.json
Normal file
File diff suppressed because one or more lines are too long
3
.lighthouseci/links.json
Normal file
3
.lighthouseci/links.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"https://e-tib.com/en": "https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/reports/1782063743188-8000.report.html"
|
||||||
|
}
|
||||||
@@ -43,11 +43,7 @@ export function HeroVideo(props: HeroVideoProps) {
|
|||||||
|
|
||||||
const [videoSrcLoaded, setVideoSrcLoaded] = useState(false);
|
const [videoSrcLoaded, setVideoSrcLoaded] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// If it's explicitly Lighthouse, we don't need to load the video to save bandwidth
|
|
||||||
if (navigator.userAgent.includes('Lighthouse')) return;
|
|
||||||
|
|
||||||
let interactionTriggered = false;
|
let interactionTriggered = false;
|
||||||
let timer: NodeJS.Timeout;
|
|
||||||
|
|
||||||
const handleInteraction = () => {
|
const handleInteraction = () => {
|
||||||
if (interactionTriggered) return;
|
if (interactionTriggered) return;
|
||||||
@@ -65,13 +61,7 @@ export function HeroVideo(props: HeroVideoProps) {
|
|||||||
window.addEventListener(event, handleInteraction, { passive: true, once: true })
|
window.addEventListener(event, handleInteraction, { passive: true, once: true })
|
||||||
);
|
);
|
||||||
|
|
||||||
// Fallback: load after 3.5 seconds if no interaction occurs
|
|
||||||
timer = setTimeout(() => {
|
|
||||||
handleInteraction();
|
|
||||||
}, 3500);
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearTimeout(timer);
|
|
||||||
['scroll', 'mousemove', 'touchstart', 'keydown'].forEach((event) =>
|
['scroll', 'mousemove', 'touchstart', 'keydown'].forEach((event) =>
|
||||||
window.removeEventListener(event, handleInteraction)
|
window.removeEventListener(event, handleInteraction)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user