2009-02-19 09:23:13 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
2010-05-30 15:02:06 -07:00
|
|
|
<title>Media test: Bug 465498 - Seeking after playback ended</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2009-02-19 09:23:13 -08:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
2010-05-30 15:02:06 -07:00
|
|
|
<script type="text/javascript" src="manifest.js"></script>
|
2009-02-19 09:23:13 -08:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=465498">Mozilla Bug 465498</a>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
var videos = [];
|
2009-02-19 09:23:13 -08:00
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
function startTest(e) {
|
|
|
|
e.target.play();
|
|
|
|
}
|
2009-02-19 09:23:13 -08:00
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
function playbackEnded(e) {
|
|
|
|
var v = e.target;
|
|
|
|
if (v._finished)
|
|
|
|
return;
|
|
|
|
ok(v.currentTime >= v.duration - 0.1 && v.currentTime <= v.duration + 0.1,
|
|
|
|
"Checking currentTime at end: " + v.currentTime + " for " + v._name);
|
|
|
|
ok(v.ended, "Checking playback has ended for " + v._name);
|
2009-03-31 18:07:17 -07:00
|
|
|
v.pause();
|
2009-02-19 09:23:13 -08:00
|
|
|
v.currentTime = 0;
|
2010-05-30 15:02:06 -07:00
|
|
|
ok(!v.ended, "Checking ended is no longer true for " + v._name);
|
|
|
|
v._seeked = true;
|
|
|
|
}
|
2009-02-19 09:23:13 -08:00
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
function seekEnded(e) {
|
|
|
|
var v = e.target;
|
|
|
|
if (v._finished)
|
|
|
|
return;
|
|
|
|
ok(v.currentTime == 0, "Checking currentTime after seek: " +
|
|
|
|
v.currentTime + " for " + v._name);
|
|
|
|
ok(!v.ended, "Checking ended is false for " + v._name);
|
|
|
|
v._finished = true;
|
|
|
|
if (AllFinished(videos))
|
|
|
|
SimpleTest.finish();
|
2009-02-19 09:23:13 -08:00
|
|
|
}
|
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
for (var i=0; i<gSmallTests.length; ++i) {
|
|
|
|
var test = gSmallTests[i];
|
|
|
|
var type = /^video/.test(test.type) ? "video" : "audio";
|
|
|
|
var v = document.createElement(type);
|
|
|
|
var test = gSmallTests[i];
|
|
|
|
if (!v.canPlayType(test.type))
|
|
|
|
continue;
|
|
|
|
v._name = test.name;
|
|
|
|
|
|
|
|
var s = document.createElement("source");
|
|
|
|
s.type = test.type;
|
|
|
|
s.src = test.name;
|
|
|
|
v.appendChild(s);
|
|
|
|
|
|
|
|
v._seeked = false;
|
|
|
|
v._finished = false;
|
|
|
|
v.addEventListener("loadedmetadata", startTest, false);
|
|
|
|
v.addEventListener("ended", playbackEnded, false);
|
|
|
|
v.addEventListener("seeked", seekEnded, false);
|
|
|
|
document.body.appendChild(v);
|
|
|
|
videos.push(v);
|
|
|
|
}
|
2009-02-19 09:23:13 -08:00
|
|
|
|
2010-05-30 15:02:06 -07:00
|
|
|
if (videos.length == 0) {
|
|
|
|
todo(false, "No types supported");
|
|
|
|
} else {
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2009-02-19 09:23:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|