Delivering HTML5 video with a Flash fallback
The video element now plays without a plug-in in current releases of Safari, Chrome, Firefox and Opera and in the Internet Explorer 9 beta, but no single codec is supported by all of them. Production delivery in 2010 requires more than one encoding and a Flash player for everything else.
Choose the encodings
Produce H.264 video with AAC audio in an MP4 container for Safari, iOS devices and the Internet Explorer 9 beta, and Ogg Theora or WebM for Firefox and Opera. Use the H.264 baseline profile if the same file must play on the iPhone, and keep one high-quality master from which each version is generated.
Order the sources correctly
List the MP4 source first; the iPad currently recognises only the first source element and ignores the remainder. Include the type attribute with codec parameters so each browser can reject formats it cannot play without downloading them.
Nest the Flash fallback
Place the Flash object element inside the video element so browsers without HTML5 video, including Internet Explorer 8 and earlier, display the existing player. The same MP4 file can be supplied to Flash, which avoids maintaining a separate FLV encoding.
Configure the server
Send the correct MIME type for each container; Firefox will not play Ogg video served as text/plain. Move the MP4 index to the beginning of the file so playback can start before the download completes, and confirm that range requests are supported for seeking.
Provide a final alternative
Include a poster image and a download link inside the fallback for devices with neither capability. Test with JavaScript disabled, on a real iPad and iPhone and over a constrained connection; desktop Safari is not a substitute for the device.
Browser vendors have not agreed a common format and WebM support is still arriving. Treat the encoding list as configuration that will change, not as a property of the page template.