Friday, February 04, 2011

Test embed Youtube video autoplay



So if the above plays automatically when you land on this page means test successful. So to make an embedded Youtube video autoplay, all you need to do is to add at the end of the Youtube URL &autoplay=1 and it will play automatically.

The above video was taken at Damansara Uptown: OVO live bistro

The original Youtube embed code:

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/BVa_3jn8XYY?hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BVa_3jn8XYY?hl=en&fs=1&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>


The modified Youtube embed code to make it autoplay with the added &autoplay=1 highlighted in red:

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/BVa_3jn8XYY?hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BVa_3jn8XYY?hl=en&fs=1&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>


And to further make it loop endlessly, just append &loop=1 at the end thus the code become:

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/BVa_3jn8XYY?hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BVa_3jn8XYY?hl=en&fs=1&autoplay=1&loop=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>

1 comment:

Ray said...

THANK YOU! Awesome knowledge! I'd been wondering how the loop thing works. Very aluable post!