YouTube API Blog announces that YouTube will switch to a new embedding code that uses an iframe. "If you use the new embed code style, your viewers will be able to view your embedded video in one of our Flash or HTML5 players, depending on their viewing environment and preferences. In instances where HTML5 isn't supported (e.g. our HTML5 player can't play videos with ads), we use Flash."
Here's an example of embed code:
<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
YouTube says that "an additional benefit of the new embed style is that it will eventually allow embeds to work on mobile devices, which typically use a built-in player instead of Flash or HTML5." iPhone, Android phones and other mobile devices use a special application for YouTube, while mobile browsers use plug-ins that detect YouTube's embedding code and replace it with some code that can be handled by the built-in YouTube app. The new embedding code will allow YouTube to use the HTML5 video tag in browsers that support this feature.
In a previous post, YouTube's Kuan Yong said that "Flash Player's ability to combine application code and resources into a secure, efficient package has been instrumental in allowing YouTube videos to be embedded in other web sites. Web site owners need to ensure that embedded content is not able to access private user information on the containing page, and we need to ensure that our video player logic travels with the video (for features like captions, annotations, and advertising). While HTML5 adds sandboxing and message-passing functionality, Flash is the only mechanism most web sites allow for embedded content from other sites."