Using oEmbed for Dynamic, Futureproof Embedded Videos and Photos

Jeffrey Donenfeld Blog Maintenance, Mobile, Technology 2 Comments

When writing and maintaining the codebase of my website, I’ve always tried to adhere the the highest degree of code standards compliance, flexibility, compatibility, and future maintainability and relevance. I’ve kept the use of plugins to a minimum, and have made sure that as much site content as possible is optimillay visible without the use of any special plugin or embed option. As this site glides into the future, I want all of the content to remain accessible. When it comes to embedding media content on blog posts, there’s always a question of how to embed it most effectively. With YouTube, for example, should I use the flash embed code? iFrame embed code? Straight up HTML5 tags? What’s going to be the best for acessibility now, and into the future? I always try to answer this question with asking “what’s the most simple, straightforward way to do it”. Lately with video, that answer has been YouTube’s iFrame embed code. By using this embed code, I’m essentially creating a portal in my blog post over to YouTube, and then letting YouTube decide which is the best way to display the media – whether it’s their standard flash video player, or newer h.264 or WebM video players – or whatever else comes up in the future.