- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 10 Feb 2010 02:27:52 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec In directory hutz:/tmp/cvs-serv4505 Modified Files: Overview.html Log Message: Add an example of forcing fallback from <source>. (whatwg r4685) Index: Overview.html =================================================================== RCS file: /sources/public/html5/spec/Overview.html,v retrieving revision 1.3738 retrieving revision 1.3739 diff -u -d -r1.3738 -r1.3739 --- Overview.html 10 Feb 2010 02:14:23 -0000 1.3738 +++ Overview.html 10 Feb 2010 02:27:48 -0000 1.3739 @@ -18726,6 +18726,28 @@ <a href="#reflect">reflect</a> the respective content attributes of the same name.</p> + </div><div class="example"> + + <p>If the author isn't sure if the user agents will all be able to + render the media resources provided, the author can listen to the + <code title="event-error">error</code> event on the last + <code><a href="#the-source-element">source</a></code> element and trigger fallback behaviour:</p> + + <pre><video controls autoplay> + <source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> + <source src='video.ogv' type='video/ogg; codecs="theora, vorbis"' + onerror="fallback(parentNode)"> + ... +</video> +<script> + function fallback(video) { + // replace <video> with its contents + while (video.hasChildNodes()) + video.parentNode.insertBefore(video.firstChild, video); + video.parentNode.removeChild(video); + } +</script></pre> + </div><h4 id="media-elements"><span class="secno">4.8.9 </span>Media elements</h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><p><dfn id="media-element" title="media element">Media elements</dfn> implement the following interface:<pre class="idl">interface <dfn id="htmlmediaelement">HTMLMediaElement</dfn> : <a href="#htmlelement">HTMLElement</a> {
Received on Wednesday, 10 February 2010 02:27:53 UTC