Embed YouTube videos using IFRAMES

YouTube just introduced a new video encoding method by which users will now be able to embed videos in blog post and HTML pages using IFRAMES. The regular Flash video embedding codes are still available.

To embed any video using IFRAMES just use the following code, replacing VIDEO_ID with the unique identifying code of the video which you can grab from the video URL. Adjust the width and height appropriately.

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">

The following video has been embedded using IFRAMES.

Unlike normal IFRAME behavior, resizing the size of the IFRAME automatically resizes the video contained within.

If you use the new embed code style, your viewers will be able to view your embedded video in one of our Flash or HTML5 players, depending on their viewing environment and preferences.

An additional benefit of the new embed style is that it will eventually allow embeds to work on mobile devices, which typically use a built-in player instead of Flash or HTML5.

This Article Has 2 Comments
  1. Kaushik Patowary Reply

    Well, I guess the IFRAME version doesn't allow such customization.

  2. sohaiby Reply

    i have embedded a video from microsoft's site onto my blog! When i am trying to resize that video.., it is cropping and the video not resizing itself but cropping!!!

Leave a Reply

Your email address will not be published. Required fields are marked *