iframe youtube autoplay code example

Example 1: iframe autoplay

<!-- 
first add ?autoplay=1 to your video url
then add allow='autoplay' attribute to your iframe element
-->
<iframe src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1" allow='autoplay'></iframe>

Example 2: youtube iframe autoplay not working

<iframe id="existing-iframe-example"
          width="640" height="360"
          src="https://www.youtube.com/embed/-SFcIUEvNOQ?autoplay=1&mute=1&enablejsapi=1"
          frameborder="0"
          style="border: solid 4px #37474F"
          ></iframe>

Example 3: Iframe video autoplay

<iframe src="//www.youtube.com/embed/{{YOUTUBE-ID}}?autoplay=1&mute=1" name="youtube embed" allow="autoplay; encrypted-media" allowfullscreen></iframe>

Example 4: youtube embed video

//Author:Mohammad Arman Khan
<div>
       <iframe class="videoframe" src="https://www.youtube.com/watch?v=VfGW0Qiy2I0">
       </iframe>
</div>

Tags:

Html Example