diff --git a/public/videos/smoke-poster.jpg b/public/videos/smoke-poster.jpg new file mode 100644 index 0000000..1f941c8 Binary files /dev/null and b/public/videos/smoke-poster.jpg differ diff --git a/public/videos/smoke.mp4 b/public/videos/smoke.mp4 index e953e6b..f0cf9e1 100644 Binary files a/public/videos/smoke.mp4 and b/public/videos/smoke.mp4 differ diff --git a/src/components/UserHeader.tsx b/src/components/UserHeader.tsx index 3a25427..7015601 100644 --- a/src/components/UserHeader.tsx +++ b/src/components/UserHeader.tsx @@ -134,10 +134,16 @@ export function UserHeader({ user, preferences, onModalStateChange }: UserHeader const { theme, toggleTheme } = useTheme(); const { isSupported, permission, requestPermission } = useNotifications(reminderSettings); const videoRef = useRef(null); + const [isVideoLoaded, setIsVideoLoaded] = useState(false); // Force play background video useEffect(() => { if (videoRef.current) { + // If already ready, set loaded immediately + if (videoRef.current.readyState >= 3) { + setIsVideoLoaded(true); + } + videoRef.current.play().catch((err) => { console.warn("Autoplay failed, user interaction might be needed:", err); }); @@ -251,7 +257,15 @@ export function UserHeader({ user, preferences, onModalStateChange }: UserHeader loop muted playsInline - className="absolute inset-0 w-full h-full object-cover scale-110 opacity-70 dark:opacity-50 brightness-[1.1] dark:brightness-[0.85] transition-opacity duration-1000" + preload="auto" + poster="/videos/smoke-poster.jpg" + onCanPlayThrough={() => setIsVideoLoaded(true)} + className={cn( + "absolute inset-0 w-full h-full object-cover scale-110 brightness-[1.1] dark:brightness-[0.85] transition-all duration-[2000ms] ease-in-out", + isVideoLoaded + ? "opacity-70 dark:opacity-50 blur-0" + : "opacity-40 dark:opacity-30 blur-sm" + )} >