blob: d84e4338667fedc704a2239293a864c3cf1ead1e [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
// The test.mp4 file has sync samples at the following presentation time stamps:
// 0.0000, 0.7968, 1.5936, 2.3904, 3.1872, 3.9840, 4.7808, 5.5776
function runTest()
{
findMediaElement();
waitForEvent('canplaythrough', canplaythrough);
// Other media files may have sync samples at completely different points, so
// explicitly use the .mp4 here.
video.src = "content/test.mp4";
}
function canplaythrough()
{
waitForEventOnce('timeupdate', seek1);
consoleWrite('Seek past the 4th sync sample:');
run('video.currentTime = 2.5');
}
function seek1()
{
testExpected('video.currentTime.toFixed(1)', 2.5);
consoleWrite('Test that fastSeek() past the currentTime will not result in a seek before the currentTime or past the seek time:');
waitForEventOnce('timeupdate', seek2);
run('video.fastSeek(2.6)');
}
function seek2()
{
testExpected('video.currentTime', 2.6, '<=');
testExpected('video.currentTime', 2.5, '>=');
consoleWrite('Seek before the 4th sync sample:');
waitForEventOnce('timeupdate', seek3);
run('video.currentTime = 2.3');
}
function seek3()
{
testExpected('video.currentTime.toFixed(1)', 2.3);
consoleWrite('Test that fastSeek() before the currentTime will not result in a seek past the seek time:');
waitForEventOnce('timeupdate', seek4);
run('video.fastSeek(2.2)');
}
function seek4()
{
testExpected('video.currentTime', 2.2, '<=');
endTest();
}
</script>
</head>
<body onload="runTest()">
<video controls></video>
<p>Test that fastSeek() commands work correctly.</p>
</body>
</html>