content/media/video/test/test_seek6.html
author L. David Baron <dbaron@dbaron.org>
Wed, 06 May 2009 13:46:04 -0700
changeset 28048 8f7b73d88f6bbedec99c6c8ef48b243ab922d05c
parent 23862 7e0d34e958e66bc3c8ae582657080886d1a6d6d6
permissions -rw-r--r--
Switch HTML mochitests from using MochiKit.js to packed.js. (Bug 490955) r=sayrer

<!DOCTYPE HTML>
<html>
<head>
  <title>Media test: seek test 6</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 for a seek, followed by a play before the seek completes, ensure we play at the end of the seek.
var startPassed = false;
var endPassed = false;
var completed = false;
var seekCount = 0;

function startTest() {
  if (completed)
    return false;

  var v = document.getElementById('v');
  v.currentTime=2;
  return false;
}

function seekStarted() {
  if (completed)
    return false;
  startPassed = true;
  var v = document.getElementById('v');
  v.play();
  return false;
}

function seekEnded() {
  if (completed)
    return false;
  endPassed = true;
  return false;
}

function playbackEnded() {
  if (completed)
    return false;
  ok(startPassed, "Got seeking event");
  ok(endPassed, "Got seeked event");
  completed = true;
  SimpleTest.finish();
  return false;
}

SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
       src='seek.ogv'
       onloadedmetadata='return startTest();'
       onended='return playbackEnded();'
       onseeking='return seekStarted();'
       onseeked='return seekEnded();'></video>
</body>
</html>