Skip to content

Commit

Permalink
Update EmbedCard.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
raselshikdar authored Oct 5, 2024
1 parent 317f63e commit 71798f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/EmbedCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ defineProps({
const renderEmbed = (embed: Embed) => {
switch (embed.type) {
case 'youtube':
return `<iframe width="100%" height="315" src="${embed.url}" frameborder="0" allowfullscreen></iframe>`;
// Extract the video ID from the YouTube URL
const youtubeId = embed.url.split('v=')[1]?.split('&')[0] || '';
return `<iframe width="100%" height="315" src="https://www.youtube.com/embed/${youtubeId}" frameborder="0" allowfullscreen></iframe>`;
case 'facebook':
return `<iframe src="${embed.url}" width="100%" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allow="encrypted-media"></iframe>`;
case 'm3u8':
Expand Down

0 comments on commit 71798f2

Please sign in to comment.