2014-09-03 18:57:06 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
2014-09-04 00:35:01 -07:00
|
|
|
<title>MSE: append segments with delay</title>
|
2014-09-03 18:57:06 -07:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2014-09-04 22:10:42 -07:00
|
|
|
<script type="text/javascript" src="mediasource.js"></script>
|
2014-09-03 18:57:06 -07:00
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
2014-11-18 20:16:41 -08:00
|
|
|
var updateCount = 0;
|
|
|
|
|
2014-09-11 21:34:38 -07:00
|
|
|
runWithMSE(function (ms, v) {
|
2014-09-04 22:10:42 -07:00
|
|
|
ms.addEventListener("sourceopen", function () {
|
|
|
|
var sb = ms.addSourceBuffer("video/webm");
|
|
|
|
|
|
|
|
fetchWithXHR("seek.webm", function (arrayBuffer) {
|
|
|
|
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 318));
|
2014-09-08 15:29:41 -07:00
|
|
|
sb.addEventListener("updateend", function () {
|
2014-11-18 20:16:41 -08:00
|
|
|
updateCount++;
|
|
|
|
if (updateCount == 1) {
|
2014-09-08 15:29:41 -07:00
|
|
|
window.setTimeout(function () {
|
|
|
|
sb.appendBuffer(new Uint8Array(arrayBuffer, 318));
|
|
|
|
}, 1000);
|
2014-11-18 20:16:41 -08:00
|
|
|
}
|
|
|
|
else if (updateCount == 2) {
|
2014-09-08 15:29:41 -07:00
|
|
|
ms.endOfStream();
|
|
|
|
}
|
|
|
|
});
|
2014-09-04 22:10:42 -07:00
|
|
|
v.play();
|
2014-09-03 18:57:06 -07:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-09-04 22:10:42 -07:00
|
|
|
v.addEventListener("ended", function () {
|
2014-09-09 15:51:28 -07:00
|
|
|
// XXX: Duration should be exactly 4.0, see bug 1065207.
|
|
|
|
ok(Math.abs(v.duration - 4) <= 0.002, "Video has correct duration");
|
|
|
|
ok(Math.abs(v.currentTime - 4) <= 0.002, "Video has played to end");
|
2014-09-04 22:10:42 -07:00
|
|
|
SimpleTest.finish();
|
2014-09-03 18:57:06 -07:00
|
|
|
});
|
2014-09-04 22:10:42 -07:00
|
|
|
});
|
|
|
|
|
2014-09-03 18:57:06 -07:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|