There are many benefits to using YouTube to embed videos. It speeds up user access to the video while reducing bandwidth consumption on your own hosting, and it’s a widely familiar interface with many features built in. There are several ways to customize the behavior of the YouTube video player as well.
For the purposes of this tutorial, I’m going to assume that you’re using the embed URL format (http://www.youtube.com/v/Sla2VebjkQk), rather than the link format (http://www.youtube.com/watch?v=Sla2VebjkQk). To add these URL parameters, take the video URL and add ?param=value for the first and ¶m=value for subsequent parameters. So for example, to set autoplay on and allow fullscreen mode, use http://www.youtube.com/v/Sla2VebjkQk?autoplay=1&fs=1 remember that if you’re embedding the URL in a link, iframe, or anywhere on a webpage, escape the ampersands by changing them from “&” to “&”.
1. autoplay
Can be set to 0 or 1. Default is 0. Setting it to 1 causes the video to play automatically when it’s displayed, rather than waiting for the user to press play. This is useful if it’s embedded in a light box and not loaded until the light box is displayed.
2. rel
Can be set to 0 or 1. Defaults to 1. Setting it to 0 disables the “related videos” feature from appearing at the end. This is useful because it keeps people focused on your site, rather than using it to browse YouTube.
3. playlist
This parameter can be set to a comma-separated list of videos to play after the originally linked one. If you have a long video cut into smaller parts, you can use this to play them all together.
4. loop
Can be set to 0 or 1. Default is 0. Setting it to 1 causes the video (or playlist) to be repeated indefinitely.
5. start
Set to a positive number. Playback will begin the specified number of seconds into the video, in other words, it will skip the first X seconds, where X is the value of the start parameter. Note that the seeking is approximate and may be off by up to two seconds.