One of the things that would be nice to have if embedding video in a webpage is the ability to force YouTube to play automatically when someone visits the page. And that is something you can do that is not on selectable switch on YouTube.
This is how it is done. I am assume you have uploaded the video to YouTube already. So go ahead and play the video on YouTube. Down the right hand side of the player just below the url display is a place where you can get the code to embed the file in a webpage. There are a number of selectable options. I do recommend turning off the related videos switch or you will have someone else's videos being played after yours. So copy that embed code to your webpage where you want to display the player. I have setup a sample page at Autoplay Sample
The embed code for this player as provide by YouTube was:
To this code we will add one additional parameter and that is &autoplay=1. Look in code sample to see where you need to insert that parameter to get it the player to autostart:
Using this parameter it becomes a bit of a cheap way to do push streaming as we can force autoplay of the file without incurring a bandwidth cost. One does have to put up with any YouTube issues but they certainly have come a long way to improving there service to the point this is quite a usable option.
This is how it is done. I am assume you have uploaded the video to YouTube already. So go ahead and play the video on YouTube. Down the right hand side of the player just below the url display is a place where you can get the code to embed the file in a webpage. There are a number of selectable options. I do recommend turning off the related videos switch or you will have someone else's videos being played after yours. So copy that embed code to your webpage where you want to display the player. I have setup a sample page at Autoplay Sample
The embed code for this player as provide by YouTube was:
<object width="873" height="525"><param name="movie" value="http://www.youtube.com/v/LWh2xPVMYfo&hl=en_US&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/LWh2xPVMYfo&hl=en_US&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="873" height="525"></embed></object>
To this code we will add one additional parameter and that is &autoplay=1. Look in code sample to see where you need to insert that parameter to get it the player to autostart:
<object width="873" height="525"><param name="movie" value="http://www.youtube.com/v/LWh2xPVMYfo&hl=en_US&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&hd=1&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/LWh2xPVMYfo&hl=en_US&fs=1&rel=0&autoplay=1&color1=0x2b405b&color2=0x6b8ab6&hd=1&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="873" height="525"></embed></object>
Using this parameter it becomes a bit of a cheap way to do push streaming as we can force autoplay of the file without incurring a bandwidth cost. One does have to put up with any YouTube issues but they certainly have come a long way to improving there service to the point this is quite a usable option.
