The team behind YouTube just posted a new way to embed your videos using <iframe> and its goal is to provide a more robust experience for both mobile platforms as well as regular browsers.
Back in January, YouTube rolled out its first HTML5-player on their website, which was REALLY exciting news. That player required nothing but a browser supporting HTML5, which eventually all browsers will do. And I see nothing but potential for the technique, for both developers and users. However, not all videos are viewable in HTML5, sometimes the Flash player is neccessary.
And that’s why this new embed code is genious! It uses HTML5, but switches back to the Flash player should the content, or the browser, require it. I can see this technique working on the YouTube site itself, making the upgrade to HTML5 all the more graceful, just as it should be! It warms my heart as a bulletproof web designer to see that kind of solution to an upgrade that’s both hard and neccessary.
Here is the code if anyone here wants to try it out. Just replace the VIDEO_ID with the video’s ID (the one appearing after the “v=” in the address):
<iframe type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
What DOES feel kinda iffy though is that they’re using an iframe to make it happen. I thought iframes died with good old IE6? Still, it’s still in the beta stage so everything may happen. Hopefully, they’ll get rid of it and think of some other solution.
The future looks bright indeed.
