2008-10-21 02:19:33 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Media test: ended</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-10-21 02:19:33 -07:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
// Test if the ended event works correctly.
|
2009-01-05 17:18:40 -08:00
|
|
|
var v;
|
2008-10-21 02:19:33 -07:00
|
|
|
var endPassed = false;
|
|
|
|
var completed = false;
|
|
|
|
|
|
|
|
function startTest() {
|
|
|
|
if (completed)
|
|
|
|
return false;
|
2009-01-05 17:18:40 -08:00
|
|
|
v = document.getElementById('v');
|
2008-10-21 02:19:33 -07:00
|
|
|
v.play();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function playbackEnded() {
|
|
|
|
if (completed)
|
|
|
|
return false
|
|
|
|
|
|
|
|
completed = true;
|
2008-10-23 01:02:18 -07:00
|
|
|
ok(v.currentTime >= 3.9 && v.currentTime <= 4.0,
|
|
|
|
"Checking currentTime at end: " + v.currentTime);
|
2008-10-21 02:19:33 -07:00
|
|
|
ok(v.ended, "Checking playback has ended");
|
|
|
|
SimpleTest.finish();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</pre>
|
2009-01-05 17:18:40 -08:00
|
|
|
<video id='v'
|
2009-01-16 01:07:26 -08:00
|
|
|
src='seek.ogv'
|
2009-01-05 17:18:40 -08:00
|
|
|
onloadedmetadata='return startTest();'
|
|
|
|
onended='return playbackEnded();'></video>
|
2008-10-21 02:19:33 -07:00
|
|
|
</body>
|
|
|
|
</html>
|