author Jean-Yves Avenard <>
Mon, 14 May 2018 11:32:09 +0200
changeset 476479 b3350fc6da3aca627f12da57ff55805fdbe7c6b2
parent 475443 abc9351a9c159afb31d58fc29beda855ad4f832b
child 477049 5f5b118631b0a235a75c90c16b75db31d0de0cf0
permissions -rw-r--r--
Bug 1451149 - P2. Don't fire the "stalled" event when using MSE. r=bryce When using a media element with a Media Source, the resource fetching algorithm is to be called in "local" mode: "Continue the resource fetch algorithm by running the remaining "Otherwise (mode is local)" steps, with these clarifications" Under the local mode, the steps that would cause the element to fire suspend, stalled or progress can never occur. We only prevent the stalled event to be fired, many websites rely on the progress event to be fired (such as when the init segment has been parsed). The HTML5 media spec will be amended to clearly indicate that progress is to be fired even with mediasource MozReview-Commit-ID: DkoQzoV0JzO

<!DOCTYPE html>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
  <title>MSE: resume from waiting even after format change occurred</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="mediasource.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<pre id="test"><script class="testbody" type="text/javascript">


runWithMSE(function(ms, el) {
  el.controls = true;
  once(ms, "sourceopen").then(function() {
    ok(true, "Receive a sourceopen event");
    const sb = ms.addSourceBuffer("video/mp4");
    fetchAndLoad(sb, "bipbop/bipbop_480_624kbps-video", [ "init" ], ".mp4")
    .then(fetchAndLoad.bind(null, sb, "bipbop/bipbop_480_624kbps-video", range(1, 3), ".m4s"))
    .then(function() {;
      // let seek to the last audio frame.
      // The seek will complete and then playback will stall.
      el.currentTime = 1.532517;
      return Promise.all([ once(el, "seeked"), once(el, "waiting") ]);
    .then(function() {
      info("seek completed");
      return fetchAndLoad(sb, "bipbop/bipbop", [ "init" ], ".mp4");
    .then(fetchAndLoad.bind(null, sb, "bipbop/bipbop", range(1, 4), ".m4s"))
    .then(function() {
      return once(el, "ended");
    }).then(function() {