From 1f6bd20a13d8fa200adb07499d3ae4bc576f64a7 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Thu, 7 Aug 2025 10:52:12 +0000 Subject: [PATCH] Improve video player experience with better controls and fallback images Fixes issues with missing thumbnails by adding a fallback image and ensures video controls are properly displayed and hidden. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/AbkXVNx --- .../src/components/hls-preview-thumbnail.tsx | 16 +++++ client/src/components/video-modal.tsx | 58 ++++++++++--------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/client/src/components/hls-preview-thumbnail.tsx b/client/src/components/hls-preview-thumbnail.tsx index 2054801..6798471 100644 --- a/client/src/components/hls-preview-thumbnail.tsx +++ b/client/src/components/hls-preview-thumbnail.tsx @@ -192,8 +192,24 @@ export default function HLSPreviewThumbnail({ video, onClick, className = "" }: alt={video.title} className="w-full h-full object-cover transition-all duration-300 group-hover:scale-105" data-testid={`img-hls-preview-${video.id}`} + onError={(e) => { + const target = e.target as HTMLImageElement; + target.style.display = 'none'; + // Show fallback background + if (target.parentElement) { + target.parentElement.style.background = 'linear-gradient(45deg, #374151, #4b5563)'; + } + }} /> + {/* Fallback for missing thumbnails */} +
+
+ +

Video Preview

+
+
+ {/* Overlay with play button */}
{/* Central Play/Pause Button */} - {!isPlaying && showControls && ( + {showControls && (
)} @@ -645,30 +648,33 @@ export default function VideoModal({ video, isOpen, onClose }: VideoModalProps)
-
-

- {video.title} -

-
- - {formatViews(video.views)} - - - {formatDate(video.createdAt)} - - - {formatDuration(video.duration)} - + {/* Video info - only show when not playing or when controls are visible */} + {(!isPlaying || showControls) && ( +
+

+ {video.title} +

+
+ + {formatViews(video.views)} + + + {formatDate(video.createdAt)} + + + {formatDuration(video.duration)} + +
+ {video.description && ( +

+ {video.description} +

+ )}
- {video.description && ( -

- {video.description} -

- )} -
+ )}
{/* Video Edit Modal */}