YouTube Adds HTML 5 Embedding of Videos

Here is some good news for YouTube fanboys, now you can embed YouTube videos using the new HTML5 embed code. The YouTube api blog recently announced that the team is experimenting with a new embed code that uses the iframe tag to switch between the flash and HTML5 interface.

YouTube added support for HTML5 earlier this year, followed by another popular video sharing site – Vimeo. The HTML5 video playback was limited to only a few browsers e.g Google Chrome, Safari and users were not given any embed code for the uploaded videos.

With the new iframe tag embedded in your website, the code will automatically detect whether you are using a browser that supports HTML5 or not.

The iframe code for embedding YouTube videos is as follows, simply copy the Video ID and replace in the code below:

<iframe type=”text/html” width=”640″ height=”385″ src=”http://www.youtube.com/embed/VIDEO_ID” frameborder=”0″>
</iframe>

Here is an example video embedded using the new HTML5 embed code:

Users will be able to view the embedded video in both Flash and HTML5 players, this depends on their viewing environment and browser preferences. You can find a complete list of HTML5 video players at this page

Please note that those videos which contain inline advertisements will be shown using Flash because HTML5 can not play the videos containing advertisements. The advantage of the new HTML5 embed code is that it will allow embed codes to work on various mobile devices, which use a built in player instead of either Flash or HTML5.

The new embed code is just a testing feature, more improvements are on the way. [ via YouTube API blog ]

  • Share

Related Topics Similar to This Article: »

Recent Activity: »

Read More On:

Comment Using Facebook

4 Responses to this Article | Share your Opinions/Comments

We moderate comments to prevent spam. Moderation is done within few hours. Please try and stay on topic and refrain from using abusive language. If you think there is a problem with this post, please email the post author or send us an email at tips@techie-buzz.com with the URL and the problem you see and we will rectify it as soon as we can.

  1. smokes on July 25th, 2010 at 12:46 pm #

    i have flashblock on my chrome and it showed me the video was in flash =) i mean i must unblock it before watching =)

    so its still flash

  2. Greg on October 13th, 2010 at 12:11 pm #

    Cool. One question for you though: is there a way to detect the end of video playback? I’d like to be able to close the iframe when the video has stopped playing.

  3. spoulin23 on November 16th, 2011 at 12:06 am #

    Just tryed it for fun under ie6 : detected as flash and after around 10 secondes, IE6 just crashed…

    :-O

  4. Jason on May 21st, 2012 at 10:01 pm #

    Hey guys, hate to say it, but that video “example” you have in the site above is flash player from youtube, not the html5 tag.