YouTube has announced a new version of embedding code for Youtube videos . The new code will use an iframe that lets you watch both embedded videos in Flash and in HTML5, according to the users’ browser settings.
The default is to show HTML5 , and it automatically switches to Flash if HTML5 is not available.
According to YouTube, “another benefit of the new code is that in the future Youtube will play videos on mobile devices, which typically use players’ built-in” instead of Flash or HTML5. Android and iPhone phones and others use a special application to display the videos on YouTube, while the mobile browser using a plugin that detects the YouTube code and replace it by its built-in app. The new code will use the tag in HTML5 browsers that support it.
While sandboxing and HTML5 adds functionality to transfer messages, Flash is only used practically to embed content from other websites.
Here is an example video, feel free to view source:
To embed the above video, I simple entered the following code in HTML.
<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
Change the VIDEO_ID to your own youtube Video ID. The code is much simpler and short than the original Embed codes.