[html5] r4694 - [e] (0) Add an example of <video onerror>. Fixing http://www.w3.org/Bugs/Public/ [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Feb 12 18:25:43 PST 2010


Author: ianh
Date: 2010-02-12 18:25:41 -0800 (Fri, 12 Feb 2010)
New Revision: 4694

Modified:
   complete.html
   index
   source
Log:
[e] (0) Add an example of <video onerror>.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=8733

Modified: complete.html
===================================================================
--- complete.html	2010-02-12 13:09:18 UTC (rev 4693)
+++ complete.html	2010-02-13 02:25:41 UTC (rev 4694)
@@ -157,7 +157,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <hgroup><h1>Web Applications 1.0</h1>
-    <h2 class="no-num no-toc">Draft Standard — 12 February 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 13 February 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -21497,8 +21497,41 @@
 
   </div>
 
+  <div class=example>
 
+   <p>This example shows how to detect when a video has failed to play
+   correctly:</p>
 
+   <pre><script>
+ function failed(e) {
+   // video playback failed - show a message saying why
+   switch (e.target.error.code) {
+     case e.target.error.MEDIA_ERR_ABORTED:
+       alert('You aborted the video playback.');
+       break;
+     case e.target.error.MEDIA_ERR_NETWORK:
+       alert('A network error caused the video download to fail part-way.');
+       break;
+     case e.target.error.MEDIA_ERR_DECODE:
+       alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
+       break;
+     case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
+       alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
+       break;
+     default:
+       alert('An unknown error occurred.');
+       break;
+   }
+ }
+</script>
+<p><video src="tgif.vid" autoplay controls onerror="failed(event)"></video></p>
+<p><a href="tgif.vid">Download the video file</a>.</p></pre>
+
+  </div>
+
+
+
+
   <!--CODECS
 
   <div class="impl">

Modified: index
===================================================================
--- index	2010-02-12 13:09:18 UTC (rev 4693)
+++ index	2010-02-13 02:25:41 UTC (rev 4694)
@@ -159,7 +159,7 @@
 
   <header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <hgroup><h1>HTML5 (including next generation additions still in development)</h1>
-    <h2 class="no-num no-toc">Draft Standard — 12 February 2010</h2>
+    <h2 class="no-num no-toc">Draft Standard — 13 February 2010</h2>
    </hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -21396,8 +21396,41 @@
 
   </div>
 
+  <div class=example>
 
+   <p>This example shows how to detect when a video has failed to play
+   correctly:</p>
 
+   <pre><script>
+ function failed(e) {
+   // video playback failed - show a message saying why
+   switch (e.target.error.code) {
+     case e.target.error.MEDIA_ERR_ABORTED:
+       alert('You aborted the video playback.');
+       break;
+     case e.target.error.MEDIA_ERR_NETWORK:
+       alert('A network error caused the video download to fail part-way.');
+       break;
+     case e.target.error.MEDIA_ERR_DECODE:
+       alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
+       break;
+     case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
+       alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
+       break;
+     default:
+       alert('An unknown error occurred.');
+       break;
+   }
+ }
+</script>
+<p><video src="tgif.vid" autoplay controls onerror="failed(event)"></video></p>
+<p><a href="tgif.vid">Download the video file</a>.</p></pre>
+
+  </div>
+
+
+
+
   <!--CODECS
 
   <div class="impl">

Modified: source
===================================================================
--- source	2010-02-12 13:09:18 UTC (rev 4693)
+++ source	2010-02-13 02:25:41 UTC (rev 4694)
@@ -22942,8 +22942,41 @@
 
   </div>
 
+  <div class="example">
 
+   <p>This example shows how to detect when a video has failed to play
+   correctly:</p>
 
+   <pre><script>
+ function failed(e) {
+   // video playback failed - show a message saying why
+   switch (e.target.error.code) {
+     case e.target.error.MEDIA_ERR_ABORTED:
+       alert('You aborted the video playback.');
+       break;
+     case e.target.error.MEDIA_ERR_NETWORK:
+       alert('A network error caused the video download to fail part-way.');
+       break;
+     case e.target.error.MEDIA_ERR_DECODE:
+       alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
+       break;
+     case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
+       alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
+       break;
+     default:
+       alert('An unknown error occurred.');
+       break;
+   }
+ }
+</script>
+<p><video src="tgif.vid" autoplay controls onerror="failed(event)"></video></p>
+<p><a href="tgif.vid">Download the video file</a>.</p></pre>
+
+  </div>
+
+
+
+
   <!--CODECS
 
   <div class="impl">




More information about the Commit-Watchers mailing list