Skip to content

Commit

Permalink
embed link bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
zelihapala committed May 25, 2024
1 parent d8fc586 commit cdda712
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions client/src/VideoRecommendations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,35 @@ const VideoList = () => {
});
}, []);

function changeYTLinkToEmbed(watchLink) {
const embedLink = watchLink.replace("watch?v=", "embed/");
return embedLink;
}

return (
<div className="video-list">
{videos.map((videoData, i) => (
<div className="video" data-testid="video" key={i}>
<div>
<iframe
title={videoData.title}
width="560"
height="315"
src={`https://www.youtube.com/embed/${videoData.src}`}
frameBorder="0"
allowFullScreen
></iframe>
{videos.map((videoData, i) => {
const embededLink = changeYTLinkToEmbed(videoData.src);
return (
<div className="video" data-testid="video" key={i}>
<div>
<iframe
title={videoData.title}
width="560"
height="315"
src={embededLink}
frameBorder="0"
allowFullScreen
></iframe>
</div>
</div>
</div>
))}
);
})}
</div>
);
() => {
return askxjsnj;
};
};

export default VideoList;

0 comments on commit cdda712

Please sign in to comment.