When you embed a YouTube video on a website, the user usually has to click the Play button to start playing the video. If you want to tweak that to autoplay the video as soon as it loads, here’s how to do it.
Simply add &autoplay=1 to the URL part of the embed code. For example, see the bold part in the embed code below:
<object width=”425″ height=”344″><param name=”movie” value=”http://www.youtube.com/v/h8NWQJGayf4&hl=en&fs=1&rel=0&autoplay=1“></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/h8NWQJGayf4&hl=en&fs=1&rel=0″ type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”425″ height=”344″></embed></object>
The difference can be seen in the two embedded videos below. The first uses the default embed code provided by YouTube and hence, requires you to click on the play button, while the second one starts playing automatically since we have tweaked the code.