2015-07-28 08:53:30 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html><head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
|
|
|
|
<title>MSE: |waiting| event when source data is missing</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2015-07-28 08:53:30 +03:00
|
|
|
<script type="text/javascript" src="mediasource.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test"><script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
2018-05-21 23:40:13 +03:00
|
|
|
runWithMSE(async (ms, el) => {
|
2015-07-28 08:53:30 +03:00
|
|
|
el.controls = true;
|
2018-05-21 23:40:13 +03:00
|
|
|
await once(ms, "sourceopen");
|
|
|
|
ok(true, "Receive a sourceopen event");
|
|
|
|
const audiosb = ms.addSourceBuffer("audio/mp4");
|
|
|
|
const videosb = ms.addSourceBuffer("video/mp4");
|
|
|
|
// ensure tracks end at approximately the same time to ensure ended event is
|
|
|
|
// always fired (bug 1233639).
|
|
|
|
audiosb.appendWindowEnd = 3.9;
|
|
|
|
videosb.appendWindowEnd = 3.9;
|
2018-05-30 15:18:54 +03:00
|
|
|
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", ["init"], ".mp4");
|
|
|
|
await fetchAndLoad(videosb, "bipbop/bipbop_video", ["init"], ".mp4");
|
2018-05-21 23:40:13 +03:00
|
|
|
await fetchAndLoad(audiosb, "bipbop/bipbop_audio", range(1, 5), ".m4s");
|
|
|
|
await fetchAndLoad(videosb, "bipbop/bipbop_video", range(1, 6), ".m4s");
|
|
|
|
// HTMLMediaElement fires "waiting" if somebody invokes |play()| before the MDSM
|
|
|
|
// has notified it of available data. Make sure that we get "playing" before
|
|
|
|
// we starting waiting for "waiting".
|
|
|
|
info("Invoking play()");
|
|
|
|
let p = once(el, "playing");
|
|
|
|
el.play();
|
|
|
|
await p;
|
|
|
|
ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
|
|
|
|
await once(el, "waiting");
|
|
|
|
p = once(el, "ended");
|
|
|
|
ms.endOfStream();
|
|
|
|
await p;
|
2019-02-22 12:21:13 +03:00
|
|
|
// Following bug 1524890, we now implement fully step 8 of the coded frame
|
|
|
|
// processing algorithm
|
|
|
|
// http://w3c.github.io/media-source/index.html#sourcebuffer-coded-frame-processing
|
|
|
|
// As such, duration is exactly the value of videosb.appendWindowEnd
|
|
|
|
is(el.duration, videosb.appendWindowEnd, "Video has correct duration: " + el.duration);
|
2018-05-21 23:40:13 +03:00
|
|
|
is(el.currentTime, el.duration, "Video has correct currentTime.");
|
|
|
|
SimpleTest.finish();
|
2015-07-28 08:53:30 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|