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
--- 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>