<html>
<body>
    
    <video controls></video>

    <p>
    Test 'timeupdate' events are posted while playing but not while paused.
    </p>
    <script src=media-file.js></script>
    <script src=video-test.js></script>
    <script>
        setSrcByTagName("video", findMediaFile("video", "content/test"));
    
        var timeupdateEventCount = 0;
        var countWhilePlaying = 0;

        function someTimeLater()
        {
            if (countWhilePlaying != timeupdateEventCount)
                failTest("'timeupdate' events posted after pausing");
            endTest();
        }

        function pause()
        {
            countWhilePlaying = timeupdateEventCount;
            setTimeout(someTimeLater, 400) ;
            consoleWrite("");
        }
        
        function playing()
        {
            setTimeout(function () { run("video.pause()"); }, 500) ;
            consoleWrite("");
        }

        mediaElement.addEventListener("timeupdate", function () { ++timeupdateEventCount; });

        waitForEvent('error');
        waitForEvent("loadstart");
        waitForEvent("waiting");
        waitForEvent("ratechange");
        waitForEvent("durationchange");
        waitForEvent("loadedmetadata");
        waitForEvent("loadeddata");
        waitForEvent("canplay");
        waitForEvent("pause", pause);
        waitForEvent("play");
        waitForEvent("playing", playing);

        run("video.play()");
        consoleWrite("");
    </script>

</body>
</html>
