[html5] r7331 - [e] (0) Fix an example to use the new API. Fixing https://www.w3.org/Bugs/Public [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Sep 11 16:40:27 PDT 2012


Author: ianh
Date: 2012-09-11 16:40:26 -0700 (Tue, 11 Sep 2012)
New Revision: 7331

Modified:
   complete.html
   index
   source
Log:
[e] (0) Fix an example to use the new API.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=16076
Affected topics: Video Text Tracks

Modified: complete.html
===================================================================
--- complete.html	2012-09-11 23:33:36 UTC (rev 7330)
+++ complete.html	2012-09-11 23:40:26 UTC (rev 7331)
@@ -34977,17 +34977,25 @@
 var sounds = sfx.addTextTrack('metadata');
 
 // add sounds we care about
-sounds.addCue(new TextTrackCue('dog bark', 12.783, 13.612, '', '', '', true));
-sounds.addCue(new TextTrackCue('kitten mew', 13.612, 15.091, '', '', '', true));
+function addFX(start, end, name) {
+  var cue = new TextTrackCue(start, end, '');
+  cue.id = name;
+  cue.pauseOnExit = true;
+  sounds.addCue(cue);
+}
+addFX(12.783, 13.612, 'dog bark');
+addFX(13.612, 15.091, 'kitten mew'))
 
 function playSound(id) {
   sfx.currentTime = sounds.getCueById(id).startTime;
   sfx.play();
 }
 
+// play a bark as soon as we can
 sfx.oncanplaythrough = function () {
   playSound('dog bark');
 }
+// meow when the user tries to leave
 window.onbeforeunload = function () {
   playSound('kitten mew');
   return 'Are you sure you want to leave this awesome page?';

Modified: index
===================================================================
--- index	2012-09-11 23:33:36 UTC (rev 7330)
+++ index	2012-09-11 23:40:26 UTC (rev 7331)
@@ -34977,17 +34977,25 @@
 var sounds = sfx.addTextTrack('metadata');
 
 // add sounds we care about
-sounds.addCue(new TextTrackCue('dog bark', 12.783, 13.612, '', '', '', true));
-sounds.addCue(new TextTrackCue('kitten mew', 13.612, 15.091, '', '', '', true));
+function addFX(start, end, name) {
+  var cue = new TextTrackCue(start, end, '');
+  cue.id = name;
+  cue.pauseOnExit = true;
+  sounds.addCue(cue);
+}
+addFX(12.783, 13.612, 'dog bark');
+addFX(13.612, 15.091, 'kitten mew'))
 
 function playSound(id) {
   sfx.currentTime = sounds.getCueById(id).startTime;
   sfx.play();
 }
 
+// play a bark as soon as we can
 sfx.oncanplaythrough = function () {
   playSound('dog bark');
 }
+// meow when the user tries to leave
 window.onbeforeunload = function () {
   playSound('kitten mew');
   return 'Are you sure you want to leave this awesome page?';

Modified: source
===================================================================
--- source	2012-09-11 23:33:36 UTC (rev 7330)
+++ source	2012-09-11 23:40:26 UTC (rev 7331)
@@ -38361,17 +38361,25 @@
 var sounds = sfx.addTextTrack('metadata');
 
 // add sounds we care about
-sounds.addCue(new TextTrackCue('dog bark', 12.783, 13.612, '', '', '', true));
-sounds.addCue(new TextTrackCue('kitten mew', 13.612, 15.091, '', '', '', true));
+function addFX(start, end, name) {
+  var cue = new TextTrackCue(start, end, '');
+  cue.id = name;
+  cue.pauseOnExit = true;
+  sounds.addCue(cue);
+}
+addFX(12.783, 13.612, 'dog bark');
+addFX(13.612, 15.091, 'kitten mew'))
 
 function playSound(id) {
   sfx.currentTime = sounds.getCueById(id).startTime;
   sfx.play();
 }
 
+// play a bark as soon as we can
 sfx.oncanplaythrough = function () {
   playSound('dog bark');
 }
+// meow when the user tries to leave
 window.onbeforeunload = function () {
   playSound('kitten mew');
   return 'Are you sure you want to leave this awesome page?';




More information about the Commit-Watchers mailing list