Bug 1588507 - Test that a media element's currentTime starts at 0 when playing a MediaStream. r=jib
authorAndreas Pehrson <apehrson@mozilla.com>
Mon, 04 Nov 2019 13:41:38 +0000
changeset 500368 815a4acd656b5de0a3f9b2bbcdb823e6bc82dc85
parent 500367 5904cc75e12209ae82ab2df3888870a4e4383e58
child 500369 22d25155b9eab1e2aad1cb24a3b12845e4111d6b
push id114164
push useraiakab@mozilla.com
push dateTue, 05 Nov 2019 10:06:15 +0000
treeherdermozilla-inbound@4d585c7edc76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1588507
milestone72.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 1588507 - Test that a media element's currentTime starts at 0 when playing a MediaStream. r=jib Differential Revision: https://phabricator.services.mozilla.com/D49350
testing/web-platform/tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html
--- a/testing/web-platform/tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html
+++ b/testing/web-platform/tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html
@@ -226,16 +226,32 @@ promise_test(async t => {
   for(const t of stream.getTracks()) {
     t.stop();
   }
   await new Promise(r => vid.onended = r);
   assert_greater_than_equal(vid.currentTime, lastTime,
     "currentTime advanced after stopping");
 }, "Tests that a media element with an assigned MediaStream reports the currentTime attribute as expected");
 
+promise_test(async t => {
+  const stream = await navigator.mediaDevices.getUserMedia({video: true});
+  t.add_cleanup(() => {
+    vid.srcObject = null;
+    stream.getTracks().forEach(track => track.stop());
+  });
+  vid.srcObject = stream;
+
+  await new Promise(r => t.step_timeout(r, 500));
+
+  vid.play();
+  await new Promise(r => vid.ontimeupdate = r);
+  assert_between_exclusive(vid.currentTime, 0, 0.5,
+    "currentTime starts at 0 and has progressed at first timeupdate");
+}, "Tests that a media element with an assigned MediaStream starts its timeline at 0 regardless of when the MediaStream was created");
+
 
 promise_test(async t => {
   const stream = await navigator.mediaDevices.getUserMedia({video: true});
   t.add_cleanup(() => {
     vid.srcObject = null;
     stream.getTracks().forEach(track => track.stop());
   });
   assert_equals(vid.loop, false, "loop is false by default");