HTML5 Media Support from WebKit and Opera

icon gold HTML5 Media Support from WebKit and OperaAnother nice feature from the HTML5 draft specification is now available in the WebKit nightly builds for Mac OS X. The new HTML5

To make a button that gives the user basic playback controls you could do this:

The specification also defines a set of events that can be used to react to changes in media playback and load state. For example:

To play audio from JavaScript you can simply do this:

The implementation is still a work in progress and not all features (including the ‘controls’ attribute which gives native playback controls) of the specification are there yet. The current implementation supports all formats that QuickTime supports, including installed 3rd party codecs.

The example below uses the ‘poster’ attribute of the

Opera‘s implementation is similar, including informative text when the media is not available:

3 thoughts on “HTML5 Media Support from WebKit and Opera

  1. HTML5 is much saner than prior attempts to update HTML in that all new features have to be designed to fallback *gracefully*, Opera’s “informative text” is part of the spec (and as such is supported by WebKit nightlies) — basically , (which is technically part of html5 despite having existed for more than 2 years now) will be ignored by older browsers which don’t recognise the tags as meaning anything special.

    Browsers that recognise these new tags will no to ignore the text/html inside the tags — so you can go .. and those browsers that don’t recognise the tag will render the tag as usual.

Leave a Reply

Your email address will not be published. Required fields are marked *