@@ -174,35 +174,20 @@ export default function ActivationForm({
174174 return (
175175 < div class = "relative h-screen overflow-hidden flex flex-col" style = "background-color: #1D1B1D;" >
176176 < div class = "absolute inset-0 z-0" style = "background: linear-gradient(180deg, #1D1B1D 0%, #2a2528 50%, #1D1B1D 100%);" >
177- < div id = "bg-video-container" class = "absolute inset-0 opacity-0" style = "transition: opacity 1s ease-out;" >
178- < video
179- class = "w-full h-full object-cover"
180- autoplay
181- muted
182- loop
183- playsinline
184- poster = ""
185- style = "opacity: 0.3;"
186- >
177+ < div id = "bg-video-container" class = "absolute inset-0" style = "opacity: 0; transition: opacity 1s ease-out;" dangerouslySetInnerHTML = { { __html : `
178+ <video id="bg-video" autoplay muted loop playsinline webkit-playsinline preload="auto" poster="" style="width:100%;height:100%;object-fit:cover;opacity:0.3;">
187179 <source src="https://assets.decocache.com/deriva-earth/63f76078-d3d8-46e9-8f55-bafe3c32fa6b/background2_header-(1)-(1).mp4" type="video/mp4" />
188180 </video>
189- </ div >
181+ ` } } / >
190182 </ div >
191183
192184 { /* Loading screen */ }
193185 < div id = "loading-screen" class = "absolute inset-0 z-50 flex items-center justify-center" style = "background-color: #1D1B1D;" >
194- < div class = "h-40 lg:h-48" style = "mix-blend-mode: screen;" >
195- < video
196- id = "loading-video"
197- class = "h-full w-auto"
198- autoplay
199- muted
200- playsinline
201- poster = ""
202- >
186+ < div class = "h-40 lg:h-48" style = "mix-blend-mode: screen;" dangerouslySetInnerHTML = { { __html : `
187+ <video id="loading-video" autoplay muted playsinline webkit-playsinline preload="auto" poster="" style="height:100%;width:auto;">
203188 <source src="https://assets.decocache.com/deriva-earth/d192798e-7bb1-475b-b79d-2622051e839b/animation.mp4" type="video/mp4" />
204189 </video>
205- </ div >
190+ ` } } / >
206191 </ div >
207192
208193 < style dangerouslySetInnerHTML = { { __html : `
@@ -509,27 +494,37 @@ export default function ActivationForm({
509494 bgVideo.style.opacity = '1';
510495 }
511496 }
512- // Force autoplay on mobile
497+ function forcePlay(el) {
498+ if (!el) return;
499+ el.muted = true;
500+ el.setAttribute('muted', '');
501+ el.setAttribute('playsinline', '');
502+ el.setAttribute('webkit-playsinline', '');
503+ var p = el.play();
504+ if (p && p.catch) p.catch(function() {
505+ // Retry after user interaction
506+ document.addEventListener('touchstart', function retry() {
507+ el.muted = true;
508+ el.play().catch(function(){});
509+ document.removeEventListener('touchstart', retry);
510+ }, { once: true });
511+ });
512+ }
513+
513514 var video = document.getElementById('loading-video');
514515 if (video) {
515- video.setAttribute('playsinline', '');
516- video.setAttribute('muted', '');
517- video.muted = true;
518- video.play().catch(function() {});
516+ forcePlay(video);
519517 video.addEventListener('ended', dismissLoading);
520518 video.addEventListener('error', dismissLoading);
521519 setTimeout(dismissLoading, 5000);
522520 } else {
523521 dismissLoading();
524522 }
525- // Force autoplay on background video
526- var bgVid = document.querySelector('#bg-video-container video');
527- if (bgVid) {
528- bgVid.setAttribute('playsinline', '');
529- bgVid.setAttribute('muted', '');
530- bgVid.muted = true;
531- bgVid.play().catch(function() {});
532- }
523+
524+ var bgVid = document.getElementById('bg-video');
525+ forcePlay(bgVid);
526+ // Also try when bg becomes visible
527+ setTimeout(function() { forcePlay(bgVid); }, 1500);
533528 })();
534529 `
535530 } } />
0 commit comments