Sunday, July 31, 2011

Embed youtube video in HTML

 The following code will embed a you tube video to your html page. The attributes, value and src of param with name movie and embed tags respectively holds the url to the video, which is being embedded. The last segment of the url is the video ID (which is used to identify a video). The ID in the following example is rxUm-2x-2dM. 

<object width="425" height="350">
             <param name="movie" value="http://www.youtube.com/v/rxUm-2x-2dM"/>
             <param name="wmode" value="transparent" />
             <param name="allowFullScreen" value="true" />
             <embed src="http://www.youtube.com/v/rxUm-2x-2dM"
                      type="application/x-shockwave-flash"
                      wmode="transparent" width="425" height="350"
                      allowFullScreen="true">
              </embed>
</object>

Furthermore video options such as height, width, mode, full screen can be specified, as shown in the example.  Details about video options can be found at http://code.google.com/apis/youtube/player_parameters.html.

thanks,
Shyarmal.

No comments:

Post a Comment