From 5572b7df367f2d215236e11a836827bc8fe35c2f Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Sat, 30 Aug 2025 19:44:47 +0000 Subject: [PATCH] Prevent videos from automatically playing on mobile touch interactions Remove auto-play functionality for video cards on mobile devices by disabling the hover effect initiation via touch events in `video-card.tsx`. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 074b0e4c-6171-43bd-aa98-f9e04623ca14 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/074b0e4c-6171-43bd-aa98-f9e04623ca14/Sy6XHzr --- client/src/components/video-card.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client/src/components/video-card.tsx b/client/src/components/video-card.tsx index 23dc46c..0053284 100644 --- a/client/src/components/video-card.tsx +++ b/client/src/components/video-card.tsx @@ -55,13 +55,15 @@ export default function VideoCard({ video, onClick, className = "", hideOverlay // Delay preview start to avoid loading on quick mouse passes useEffect(() => { if (isHovered) { - // Shorter delay on mobile for better touch experience + // Disable preview on mobile devices const isMobile = window.innerWidth < 768; - const delay = isMobile ? 500 : 800; // 500ms on mobile, 800ms on desktop - hoverTimeoutRef.current = setTimeout(() => { - setShowPreview(true); - }, delay); + if (!isMobile) { + const delay = 800; // Only on desktop + hoverTimeoutRef.current = setTimeout(() => { + setShowPreview(true); + }, delay); + } } else { if (hoverTimeoutRef.current) { clearTimeout(hoverTimeoutRef.current); @@ -126,8 +128,6 @@ export default function VideoCard({ video, onClick, className = "", hideOverlay className={`video-card transition-transform duration-200 hover:scale-[1.02] ${className}`} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} - onTouchStart={() => setIsHovered(true)} - onTouchEnd={() => setIsHovered(false)} > {/* Video preview container */}