Fallback options in HTML5 audio and video tags

HTML5 provides a fallback option for its audio and video tag elements.  Some browsers still don’t support HTML5 and for those users, if HTML5 audio and video tags are used in a website they might miss the data in the audio and video tags, in such a case HTML5 provides us with a fallback option. An alternative option is to play the media in the specification supported by the browser.

This following example explains 2 cases where fallback options can be used. If the browser supports HTML5 video then the specified format is used else the format specified in the fallback option is used.

 

Using Flash

 

Flash plugin can be used in the case <video> element is not supported.

Java applet to play ogg videos

 

This following code can be used to play Ogg support in the browsers that have support to java but don’t support HTML5.

Handling Errors

 

In HTML5 if any error occurs due to an event this error event will be dispatched to the appropriate source rather than the media tag itself.

Since Firefox does not support MP4 and 3GP due to their patent-encumbered nature.The <source> tags which has Id’s mp4_src and 3gp_src will not load . These sources are tried in the same order as they appear in the web browser and once one load successfully, the remaining sources aren’t tried at all.