gecko/content/media/test/test_timeupdate1.html

57 lines
1.3 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<title>Media test: timeupdate during playback</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 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,
"currentTime (" + v.currentTime +
") should be greater than last time (" + lastTime + ")");
lastTime = v.currentTime;
return false;
}
function playbackEnded() {
if (completed)
return false
completed = true;
SimpleTest.finish();
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
src='seek.ogv'
onloadedmetadata='return startTest();'
onended='return playbackEnded();'
ontimeupdate='return timeUpdated();'></video>
</body>
</html>