Skip to content

Commit 17d308f

Browse files
committed
fix: defaultImage 설정
1 parent b3520c4 commit 17d308f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

frontend/src/components/main/LiveVideoCard.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ const LiveVideoCard = ({ videoData }: LiveVideoCardProps) => {
2626
liveTitle,
2727
streamUrl
2828
} = videoData;
29-
29+
console.log("videoData", videoData);
3030
const { isHovered, isVideoLoaded, videoRef, handleMouseEnter, handleMouseLeave } = useVideoPreview(streamUrl);
3131

3232
const handleLiveClick = () => {
3333
navigate(`/live/${liveId}`);
3434
};
35+
console.log("liveImageUrl", liveImageUrl);
36+
console.log("defaultThumbnailImageUrl", defaultThumbnailImageUrl);
37+
38+
const handleError = (event: React.SyntheticEvent<HTMLImageElement>) => {
39+
event.currentTarget.src = defaultThumbnailImageUrl
40+
};
3541

3642
return (
3743
<VideoCardContainer>
@@ -40,7 +46,7 @@ const LiveVideoCard = ({ videoData }: LiveVideoCardProps) => {
4046
<video ref={videoRef} muted playsInline preload="none" />
4147
</VideoBox>
4248
<VideoCardThumbnail $isVideoVisible={isHovered && isVideoLoaded}>
43-
<VideoCardImage src={liveImageUrl ?? defaultThumbnailImageUrl} />
49+
<VideoCardImage src={liveImageUrl ?? defaultThumbnailImageUrl} onError={handleError}/>
4450
</VideoCardThumbnail>
4551
<VideoCardDescription>
4652
<LiveBadge />

0 commit comments

Comments
 (0)