2014-09-04 07:35:01 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>MSE: seeking in buffered range</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2014-09-05 05:10:42 +00:00
|
|
|
<script type="text/javascript" src="mediasource.js"></script>
|
2014-09-04 07:35:01 +00: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-09-12 04:34:38 +00:00
|
|
|
runWithMSE(function (ms, v) {
|
2014-09-05 05:10:42 +00:00
|
|
|
ms.addEventListener("sourceopen", function () {
|
|
|
|
var sb = ms.addSourceBuffer("video/webm");
|
|
|
|
|
|
|
|
fetchWithXHR("seek.webm", function (arrayBuffer) {
|
|
|
|
sb.appendBuffer(new Uint8Array(arrayBuffer));
|
2014-09-08 22:29:41 +00:00
|
|
|
sb.addEventListener("updateend", function () {
|
2014-11-19 03:00:09 +00:00
|
|
|
ms.endOfStream()
|
2014-09-08 22:29:41 +00:00
|
|
|
});
|
2014-09-04 07:35:01 +00:00
|
|
|
});
|
2014-09-05 05:10:42 +00:00
|
|
|
|
|
|
|
var target = 2;
|
|
|
|
|
|
|
|
v.addEventListener("loadedmetadata", function () {
|
|
|
|
if (v.currentTime != target &&
|
|
|
|
v.buffered.length &&
|
|
|
|
target >= v.buffered.start(0) &&
|
|
|
|
target < v.buffered.end(0)) {
|
|
|
|
v.currentTime = target;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var wasSeeking = false;
|
|
|
|
|
|
|
|
v.addEventListener("seeking", function () {
|
|
|
|
wasSeeking = true;
|
2014-10-02 05:04:06 +00:00
|
|
|
is(v.currentTime, target, "Video currentTime at target");
|
2014-09-05 05:10:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
v.addEventListener("seeked", function () {
|
|
|
|
ok(wasSeeking, "Received expected seeking and seeked events");
|
2014-10-02 05:04:06 +00:00
|
|
|
is(v.currentTime, target, "Video currentTime at target");
|
2014-09-05 05:10:42 +00:00
|
|
|
SimpleTest.finish();
|
2014-09-04 07:35:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|