hixie: Example of automatically showing a sign-language track when one is available (whatwg r6210)

hixie: Example of automatically showing a sign-language track when one
is available (whatwg r6210)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4976&r2=1.4977&f=h
http://html5.org/tools/web-apps-tracker?from=6209&to=6210

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4976
retrieving revision 1.4977
diff -u -d -r1.4976 -r1.4977
--- Overview.html 9 Jun 2011 22:39:19 -0000 1.4976
+++ Overview.html 10 Jun 2011 20:38:08 -0000 1.4977
@@ -318,7 +318,7 @@
 
    <h1>HTML5</h1>
    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
-   <h2 class="no-num no-toc" id="editor-s-draft-9-june-2011">Editor's Draft 9 June 2011</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-10-june-2011">Editor's Draft 10 June 2011</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -464,7 +464,7 @@
   Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation
   track.
-  This specification is the 9 June 2011 Editor's Draft.
+  This specification is the 10 June 2011 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><p>Work on this specification is also done at the <a href="http://www.whatwg.org/">WHATWG</a>. The W3C HTML working group
   actively pursues convergence with the WHATWG, as required by the <a href="http://www.w3.org/2007/03/HTML-WG-charter">W3C HTML working
   group charter</a>.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
@@ -24548,6 +24548,40 @@
   element</a>, even if another <a href="#media-resource">media resource</a> is
   loaded into the element: the objects are reused.</p>
 
+  </div><div class="example">
+
+   <p>In this example, a script defines a function that takes a URL to
+   a video and a reference to an element where the video is to be
+   placed. That function then tries to load the video, and, once it is
+   loaded, checks to see if there is a sign-language track available.
+   If there is, it also displays that track. Both tracks are just
+   placed in the given container; it's assumed that styles have been
+   applied to make this work in a pretty way!</p>
+
+   <pre>&lt;script&gt;
+ function loadVideo(url, container) {
+   var controller = new MediaController();
+   var video = document.createElement('video');
+   video.src = url;
+   video.autoplay = true;
+   video.controls = true;
+   video.controller = controller;
+   container.appendChild(video);
+   video.onloadedmetadata = function (event) {
+     for (var i = 0; i &lt; video.videoTracks.length; i += 1) {
+       if (video.videoTracks.getKind(i) == 'sign') {
+         var sign = document.createElement('video');
+         sign.src = url + '#track=' + video.videoTracks.getID(i);
+         sign.autoplay = true;
+         sign.controller = controller;
+         container.appendChild(sign);
+         return;
+       }
+     }
+   };
+ }
+&lt;/script&gt;</pre>
+
   </div><h6 id="tracklist-objects"><span class="secno">4.8.10.10.1 </span><code><a href="#tracklist">TrackList</a></code> objects</h6><p>The <code><a href="#multipletracklist">MultipleTrackList</a></code> and
   <code><a href="#exclusivetracklist">ExclusiveTrackList</a></code> interfaces, used by the attributes
   defined in the previous section, are substantially similar. Their

Received on Friday, 17 June 2011 09:53:26 UTC