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

            function canPlayThrough()
            {
                consoleWrite("EVENT(canplaythrough)");
                if (++canPlayThroughCount == 2)
                    testGetStartDate()
            }

            function start()
            {
                findMediaElement();
 
                video = document.getElementById("source_without_start_date");
                video.src = "../resources/hls/test-vod.m3u8";
                video.addEventListener('canplaythrough', canPlayThrough, true);

                video = document.getElementById('source_with_start_date');
                video.src = "../resources/hls/test-vod-date-time.m3u8";
                video.addEventListener('canplaythrough', canPlayThrough, true);
            }
    
            function testGetStartDate()
            {
                video = document.getElementById("source_without_start_date");
                testExpected("isNaN(video.getStartDate())", true );
                video = document.getElementById('source_with_start_date');
                testExpected("video.getStartDate().toUTCString()", "Wed, 03 Nov 2010 08:00:00 GMT");

                endTest();
            }
        </script>
    </head>
    <body onload="start()">
        <video id="source_with_start_date" autoplay="autoplay" width="640" height="480"></video>
        <video id="source_without_start_date" autoplay="autoplay" width="640" height="480"></video>
        <p>Test that getStartDate() returns appropriate NaN or date.</p>
    </body>
</html>
