Bug 1314886 - Call mozCaptureStream() after "loadedmetadata" in test_streams_element_capture_reset. r=jwwang
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 30 Dec 2016 10:56:49 +0100
changeset 327769 bafb20dd3221beb50523cbe731ac5c0cc6375e87
parent 327768 ae88fa85a86ba5c945cd1ad8368bd04e37ed0344
child 327770 daa6d8c357580b3840e1057886b20154b85eb5ba
push id31150
push userphilringnalda@gmail.com
push dateMon, 02 Jan 2017 18:54:30 +0000
treeherdermozilla-central@c91249f41e37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1314886
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1314886 - Call mozCaptureStream() after "loadedmetadata" in test_streams_element_capture_reset. r=jwwang MozReview-Commit-ID: 1i5VIfCWWRy
dom/media/test/test_streams_element_capture_reset.html
--- a/dom/media/test/test_streams_element_capture_reset.html
+++ b/dom/media/test/test_streams_element_capture_reset.html
@@ -12,18 +12,16 @@
 <video id="vout_untilended"></video>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 SimpleTest.waitForExplicitFinish();
 
 var v = document.getElementById('v');
 var vout = document.getElementById('vout');
 var vout_untilended = document.getElementById('vout_untilended');
-vout.srcObject = v.mozCaptureStream();
-vout_untilended.srcObject = v.mozCaptureStreamUntilEnded();
 
 function dumpEvent(event) {
   var v = event.target;
   info(v.name + " GOT EVENT " + event.type +
        " currentTime=" + v.currentTime +
        " paused=" + v.paused +
        " ended=" + v.ended +
        " readyState=" + v.readyState);
@@ -96,27 +94,37 @@ function startTest(test) {
     v.pause();
     v.currentTime = seekTime;
     v.addEventListener("seeked", seeked, false);
   };
 
   v.addEventListener("ended", ended, false);
   vout_untilended.addEventListener("ended", ended, false);
 
-  v.src = test.name;
-  v.name = test.name;
-  v.play();
-
   function checkNoEnded() {
     ok(false, "ended event received unexpectedly");
   };
 
   vout.addEventListener("ended", checkNoEnded, false);
-  vout.play();
-  vout_untilended.play();
+
+  v.src = test.name;
+  v.name = test.name;
+  v.preload = "metadata";
+
+  function loadedmetadata() {
+    vout.srcObject = v.mozCaptureStream();
+    vout.play();
+
+    vout_untilended.srcObject = v.mozCaptureStreamUntilEnded();
+    vout_untilended.play();
+
+    v.play();
+  };
+
+  v.addEventListener("loadedmetadata", loadedmetadata, {once: true});
 }
 
 var testVideo = getPlayableVideo(gSmallTests);
 if (testVideo) {
   startTest(testVideo);
 } else {
   todo(false, "No playable video");
 }