2007-06-09
HTML 5 Video Javascript Wrapper
The Metavid blog has a post about the HTML 5 Video element and how it can be supported in browsers that don't have native support for <video>.
When their Javascript code, mv_embed
, is included in a page it goes through the DOM and replaces all <video> elements with whatever playback method the client browser supports. If it supports HTML 5 <video> then it does nothing.
The replaced element is represented by a Javascript object with as much of the HTML 5 video Javascript API implemented as supported by the particular playback method. In this way code can be written to the standard API which works across all browsers. Very nice!
I'm making good progress on the Firefox implementation of native Ogg Theora playback. Today I got audio working by decoding the Vorbis stream within the video and using the portaudio library to control the sound hardware. I had multiple videos playing on a single page, each with sound, mixing well.