From a0083e52192c2f3f3039a17c56f42eb43d7a4e40 Mon Sep 17 00:00:00 2001 From: vshnosngh Date: Thu, 5 Nov 2026 13:44:30 +0530 Subject: [PATCH] fix(media): ensure video plays continuously all the time on all devices without requiring hover --- .../sections/ShiftableToolsGridSection.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/sections/ShiftableToolsGridSection.tsx b/src/components/sections/ShiftableToolsGridSection.tsx index 5e60c2f..79f859f 100644 --- a/src/components/sections/ShiftableToolsGridSection.tsx +++ b/src/components/sections/ShiftableToolsGridSection.tsx @@ -288,17 +288,16 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered: } }, []); - // Video Autoplay Muted Loop only on Hover (No zoom, no scale) + // Continuous Autoplay Muted Loop (Plays all the time on phones and desktop without requiring hover) useEffect(() => { if (item.mediaType === 'video' && videoRef.current) { - if (isHovered) { - videoRef.current.play().catch(() => {}); - } else { - videoRef.current.pause(); - videoRef.current.currentTime = 0; - } + const video = videoRef.current; + video.muted = true; + video.defaultMuted = true; + video.playsInline = true; + video.play().catch(() => {}); } - }, [isHovered, item.mediaType]); + }, [item.mediaType]); // When unhovered, reset slider smoothly to 50% useEffect(() => { @@ -439,9 +438,11 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered: ref={videoRef} src={item.videoUrl} poster={item.poster} + autoPlay muted loop playsInline + preload="auto" className="absolute inset-y-0 left-1/2 -translate-x-1/2 h-full w-[680px] max-w-none object-cover pointer-events-none transform-gpu will-change-transform [backface-visibility:hidden]" /> {/* GPU-composited overlay (opacity only) */}