Bug 1357040: P4. Don't assume the duration found when reading metadata will be the final one. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 28 Apr 2017 16:16:51 +0200
changeset 571846 80ecba8ef948283d3ef5cdafd82b3b204a729d40
parent 571845 18f0815dd4996e08154bc17f9d2990a552c894ce
child 571847 41f24719296544f47432d5ab790d89ba6097bbd9
push id56921
push userbmo:jyavenard@mozilla.com
push dateWed, 03 May 2017 10:07:51 +0000
reviewersgerald
bugs1357040
milestone55.0a1
Bug 1357040: P4. Don't assume the duration found when reading metadata will be the final one. r?gerald When endOfStream() is called, the duration is changed to that of the last buffered frame's end time. The ended event will only be fired if currentTime is equal to the duration. So if the duration has changed following a call to endOfStream, then playback won't be considered as ended. MozReview-Commit-ID: DBu3LorwFTI
dom/media/mediasource/test/test_EndedEvent.html
--- a/dom/media/mediasource/test/test_EndedEvent.html
+++ b/dom/media/mediasource/test/test_EndedEvent.html
@@ -15,17 +15,17 @@ SimpleTest.waitForExplicitFinish();
 runWithMSE(function(ms, el) {
   once(ms, 'sourceopen').then(function() {
     var sb = ms.addSourceBuffer("video/webm");
     fetchWithXHR("seek.webm", (buf) => sb.appendBuffer(new Uint8Array(buf)));
     sb.addEventListener("updateend", () => ms.endOfStream());
 
     // Test 'ended' is fired when seeking to the end of the media
     // once the duration is known.
-    el.onloadedmetadata = () => {
+    ms.onsourceended = () => {
       el.currentTime = el.duration;
     };
     el.addEventListener("ended", SimpleTest.finish.bind(null));
   });
 });
 
 </script>
 </pre>