Embed YouTube Videos with HTML5 Compatibility

Posted by Aaron Precious on Thursday, 24 October 2013
Tags - HTML5 | YouTube

A new way to embed YouTube videos which allows your embedded video to render in either Flash or a HTML5 player, depending on the viewing environment and preferences.

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

By using this new syntax for embedding YouTube videos you ensure your video will be viewable to a greater audience range. For instance the old method for YouTube embedding would render as a Flash player and those running iOS software, which is not Flash compatible, would not be able to see your embedded videos. With the above syntax your embedded videos will now render as HTML5 thus allowing iOS and other viewers who could not view Flash videos to now see your videos.

One thing to keep in mind though is that in instances where HTML5 isn't supported (e.g. YouTube's HTML5 player can't play videos with ads), it will use Flash.

0.0/5 rating (0 votes)

Comments (0)

Leave a comment

You are commenting as guest. Optional login below.