2008-10-23 01:02:18 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Media test: timeupdate during playback</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2008-10-23 01:02:18 -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 timeupdate is dispatched and the current time during the
|
|
|
|
// update is increasing.
|
|
|
|
var lastTime = 0.0;
|
|
|
|
var completed = false;
|
|
|
|
|
|
|
|
function startTest() {
|
|
|
|
if (completed)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
var v = document.getElementById('v');
|
|
|
|
v.play();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function timeUpdated() {
|
|
|
|
if (completed)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
var v = document.getElementById('v');
|
|
|
|
ok(v.currentTime > lastTime,
|
2010-04-01 20:03:07 -07:00
|
|
|
"currentTime (" + v.currentTime +
|
|
|
|
") should be greater than last time (" + lastTime + ")");
|
2008-10-23 01:02:18 -07:00
|
|
|
lastTime = v.currentTime;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function playbackEnded() {
|
|
|
|
if (completed)
|
|
|
|
return false
|
|
|
|
|
|
|
|
completed = true;
|
|
|
|
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();'
|
|
|
|
ontimeupdate='return timeUpdated();'></video>
|
2008-10-23 01:02:18 -07:00
|
|
|
</body>
|
|
|
|
</html>
|