Youtube link in video tag

<Video> tag supports 3 type of formats:

  • MP4
  • WebM
  • Ogg

Youtube doesn’t expose the raw format of the video , the youtube videos don’t end with .mp4 or other file formats , youtube just provides a video ID, at the end of the link, that’s why we cannot use youtube videos inside the video tag , However , if you want to use them inside <video> tag then  you have to do it using the Youtube API using MediaElementPlayer.

So, the best way to display youtube videos on your page without following any complicated coding is to use <iframe> tag provided by HTML5 :

<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY">
</iframe>

If you have your own video in a format that is not supported by <video> tag so instead of converting it into the format that is supported by <video> tag , it is better that you upload your video on youtube and get the unique video id and using that id you can display the video on your page using <iframe> tag.