Insert embeded YouTube video in Markdown, VS Code

I need to insert autoplaying YouTube video in Markdown, VS Code, how can I do it?

![video](YouTube link)

Upvotes: 1

Views: 8218

Answers (2)

Snailedlt
Snailedlt

Reputation: 674

In case you can't use HTML elements like iframe

I made an API which gets the video's thumbnail, then adds a play button and backdrop to it.

You can use it in markdown like this:

[![](https://markdown-videos-api.jorgenkh.no/youtube/{video_id})](https://youtu.be/{video_id})

Clicking on the image will open the video in your browser.

Demo:

[![](https://markdown-videos-api.jorgenkh.no/youtube/dQw4w9WgXcQ)](https://youtu.be/dQw4w9WgXcQ)

GitHub repo can be found here -> https://github.com/Snailedlt/Markdown-Videos

Edit

I also made a website to generate the code for you based on the link: https://markdown-videos.jorgenkh.no/

Upvotes: 6

Basilios
Basilios

Reputation: 19

Open YouTube video in your browser → Press ShareEmbedCopy iframe and paste it in your markdown document.

Or just copy code the below and replace YOUTUBE_LINK with your link

<center>
 <iframe width="560" 
         height="315" 
         src="YOUTUBE_LINK" 
         title="YouTube video player" 
         frameborder="0" 
         allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
         allowfullscreen>
 </iframe>
</center>

Upvotes: -1

Related Questions