how to set autoplay in iframe 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: disable autoplay in html iframe

<iframe width="{$width}" height="{$height}" src="http://blank.com/embed/{$id}" allowfullscreen="" controls="" autoplay="" frameborder="0" scrolling="no"></iframe>
<iframe width="{$width}" height="{$height}" src="http://blank.com/embed/{$id}" allowfullscreen="" controls="controls" autoplay="false" frameborder="0" scrolling="no"></iframe>
<iframe width="{$width}" height="{$height}" src="http://blank.com/embed/{$id}" allowfullscreen="" controls="0" autoplay="0" frameborder="0" scrolling="no"></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>

Tags:

Html Example