2008-10-19 00:39:21 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Media test: seek test 4</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-10-19 00:39:21 -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>
|
|
|
|
<video id='v'
|
2009-01-16 01:07:26 -08:00
|
|
|
src='seek.ogv'
|
2008-10-19 00:39:21 -07:00
|
|
|
onloadedmetadata='return startTest();'
|
|
|
|
onseeking='return seekStarted();'
|
|
|
|
onseeked='return seekEnded();'></video>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
// Test seeking works if current time is set but video is not played.
|
|
|
|
var startPassed = false;
|
|
|
|
var completed = false;
|
|
|
|
|
|
|
|
function startTest() {
|
|
|
|
if (completed)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
var v = document.getElementById('v');
|
|
|
|
v.currentTime=2;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function seekStarted() {
|
|
|
|
if (completed)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
startPassed = true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function seekEnded() {
|
|
|
|
if (completed)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
var t = document.getElementById('v').currentTime;
|
2009-05-17 17:25:05 -07:00
|
|
|
ok(t >= 1.9 && t <= 2.1, "Video currentTime should be around 2: " + t);
|
2008-10-19 00:39:21 -07:00
|
|
|
completed = true;
|
|
|
|
SimpleTest.finish();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|