gecko/content/media/test/test_wav_trunc_seek.html

55 lines
1.4 KiB
HTML
Raw Normal View History

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