<!DOCTYPE html>
<html>
    <head>
        <script src=../../media-resources/video-test.js></script>
        <script src=../../media-resources/media-file.js></script>

        <script>
            var media = findMediaFile('audio', '../../../../media/content/silence');
            var type = mimeTypeForExtension(media.split('.').pop());
            var audio;

            function start()
            {
                audio = document.querySelector("audio");
                audio.src = 'http://127.0.0.1:8000/media/resources/load-video.py?name=' + media + '&type=' + type + '&ranges=no';

                waitForEventAndFail('error');
                waitForEventAndEnd('ended');
                waitForEventOnce('playing', canPlay);
            }

            function canPlay()
            {
                run("audio.currentTime = 0.5");
                consoleWrite("");
            }
        </script>
    </head>
    <body onload="start()">
        <audio controls autoplay></audio>
        <p><b>Test ended by:</b>
        <ol>
            <li>Seek media file served by a server not supporting "Range" requests.</li>
            <li>Verify that the 'ended' event fires upon finishing the playback.</li>
        </ol>
        </p>
        <br/>
    </body>
</html>
