Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Friday, May 3, 2019

How to add autoplay and a loop to a Youtube video on HTML?

  1. On a computer, go to the YouTube video that you want to embed.
  2. Under the video, click Share .
  3. Click Embed.
  4. From the box that appears, copy the HTML code.
  5. Paste the code into your blog or website HTML.

To allow your video to auto play use this src="code?rel=0&controls=0&showinfo=0;autoplay=1&mute=1" as well as having allow="autoplay; encrypted-media" in your code.
Use the steps above to embed your video through youtube first and then add the autoplay=1 to your video url.


Example :

Youtube code

<iframe width="560" height="315" src="https://www.youtube.com/embed/byaVF9RwyR0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="1" height="1" src="https://www.youtube.com/embed/byaVF9RwyR0? rel=0&amp;controls=0&amp;showinfo=0;autoplay=1&mute=0" frameborder="0" allow="autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


Example : 
  • <iframe width="1" height="1" src="https://www.youtube.com/embed/byaVF9RwyR0? rel=0&amp;controls=0&amp;showinfo=0;autoplay=1&mute=0" frameborder="0" allow="autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>



Sourse : here