HTML5 Embed for YouTube Videos
September 2, 2010If you are looking to get your Youtube videos to work on mobile devices such as iPhone, iPad and Android – YouTube has enabled <iframe> ability to make you videos html5 complaint and not flash based – “In instances where HTML5 isn’t supported (e.g. our HTML5 player can’t play videos with ads), we use Flash”.
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.
Here is an example:
I started to convert some of my sites videos and found it worked great (example – http://www.thepolishguy.com homepage video). There are some limitations but over all the code worked as described. One issue I am working through is the ability to have a page of <iframe> videos – 12 in total. The issue is because I am using the <iframe> in the side bar when I add more html5 videos to the content section the code returns all items in the side bar as a <ul> list item. Will update the post when issue is resolved.