2008-12-14 06:54:45 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Wave Media test: seeking in truncated file</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-12-14 06:54:45 -08: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.
|
|
|
|
var endPassed = false;
|
|
|
|
var completed = false;
|
|
|
|
|
|
|
|
function startTest() {
|
|
|
|
if (completed)
|
|
|
|
return false;
|
2009-01-05 17:18:40 -08:00
|
|
|
var v = document.getElementById('v');
|
2008-12-15 20:58:33 -08:00
|
|
|
ok(v.duration > 1.7 && v.duration < 1.9, "Duration should be around 1.8: " + v.duration);
|
2008-12-14 06:54:45 -08:00
|
|
|
|
2008-12-15 20:58:33 -08:00
|
|
|
v.currentTime = 3.0;
|
2008-12-14 06:54:45 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function endTest() {
|
2009-01-05 17:18:40 -08:00
|
|
|
var v = document.getElementById('v');
|
2008-12-14 06:54:45 -08:00
|
|
|
ok(v.ended, "Checking ended set after seeking to EOF and playing");
|
|
|
|
SimpleTest.finish();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function endSeek() {
|
|
|
|
if (completed)
|
|
|
|
return false
|
2009-01-05 17:18:40 -08:00
|
|
|
var v = document.getElementById('v');
|
2008-12-14 06:54:45 -08:00
|
|
|
completed = true;
|
2008-12-15 20:58:33 -08:00
|
|
|
ok(v.currentTime >= 1.7 && v.currentTime <= 1.9,
|
2008-12-14 06:54:45 -08:00
|
|
|
"Checking currentTime at end: " + v.currentTime);
|
|
|
|
v.play();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</pre>
|
2009-01-05 17:18:40 -08:00
|
|
|
<audio id='v'
|
|
|
|
onloadedmetadata='return startTest();'
|
|
|
|
onseeked='return endSeek();'
|
|
|
|
onended='return endTest();'>
|
|
|
|
<source type='audio/x-wav' src='r11025_u8_c1_trunc.wav'>
|
|
|
|
</audio>
|
2008-12-14 06:54:45 -08:00
|
|
|
</body>
|
|
|
|
</html>
|