How to embed a Youtube video into your website (+autoplay/loop)🎥

The Frontend world is moving more and more to dynamic content including animations and videos.

Having a video within your site today. So here?s how:

1.) Embed a youtube video in your website. ?

Just paste this tag within your HTML, replacing the youtube video URL with your own (and also adjust your own width and height):

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

2.) Have the video AutoPlay(start the video on load). ??

Add ??autoplay=1? to the end of your youtube URL:

<iframe width=”420″ height=”315″src=”https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1″></iframe>

3.) Have the video continuously Loop (for ex. as a background vid) ?

Add ?&loop=1? to the end of your youtube URL:

<iframe width=?420″ height=?315″src=?https://www.youtube.com/embed/tgbNymZ7vqY?playlist=tgbNymZ7vqY&loop=1″></iframe>

And Wala, you have successfully embedded a video onto your website! ?

Thanks for reading and tell me if you have any questions!

10

No Responses

Write a response