diff --git a/client/src/components/video-card.tsx b/client/src/components/video-card.tsx index 375eb4a..fb22be8 100644 --- a/client/src/components/video-card.tsx +++ b/client/src/components/video-card.tsx @@ -61,20 +61,20 @@ export default function VideoCard({ video, onClick, onShare }: VideoCardProps) { alt={video.title} className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300" data-testid={`img-thumbnail-${video.id}`} + onLoad={() => { + console.log('Thumbnail loaded successfully:', video.thumbnailUrl); + }} onError={(e) => { - // Create video preview iframe as fallback if thumbnail fails + console.error('Thumbnail failed to load:', video.thumbnailUrl); + // Use a data URL SVG as fallback const target = e.target as HTMLImageElement; - const container = target.parentElement; - if (container) { - container.innerHTML = ` - - `; - } + const fallbackSvg = ` + + + Thumbnail Error + + `; + target.src = 'data:image/svg+xml;base64,' + btoa(fallbackSvg); }} /> diff --git a/server/routes.ts b/server/routes.ts index cadf4bd..60cd1d6 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -167,8 +167,9 @@ export async function registerRoutes(app: Express): Promise { `; - res.setHeader('Content-Type', 'image/svg+xml'); + res.setHeader('Content-Type', 'image/svg+xml; charset=utf-8'); res.setHeader('Cache-Control', 'public, max-age=86400'); + res.setHeader('Access-Control-Allow-Origin', '*'); res.send(svg); } catch (error) { diff --git a/test.svg b/test.svg new file mode 100644 index 0000000..7762322 --- /dev/null +++ b/test.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + Alex Reichinger - Ciao mia bella + + + 3:02 + + \ No newline at end of file