How can I embed youtube video with autoplay function on my website?

You can easily embed Youtube video with autoplay function when page load but listen – autoplay function of youtube embedded video doesn’t work on mobile devices. I mean when you open your page in the desktop, laptop, then autoplay function works but when you open your website page on mobile devices, then youtube video doesn’t start automatically.

Here is the code for embedding youtube video with an autoplay function. Just copy whole code and paste it in your website page, must replace with your own Youtube video URL ID with current video URL ID – https://www.youtube.com/embed/WrsyXjiuQMI

<style>.embed-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style><div class="embed-container"><iframe src="https://www.youtube.com/embed/WrsyXjiuQMI?autoplay=1&rel=0&vq=hd720" frameborder="0" allowfullscreen=""></iframe></div>

Just put “?autoplay=1” in the URL of embedded youtube video code to autostart or autoplay youtube video without clicking on the play button.

After adding code, your URL would be looking like this – :

http://www.youtube.com/embed/JW5meKfy3fY?autoplay=1

In case, if you want to disable the autoplay function of Youtube video, then just change the code ?autoplay=1 to ?autoplay=0

I hope you understood how to embed youtube video with autoplay or autostart function.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

0

Comments

0 comments