<!DOCTYPE html>
<html>
<head>
    <title>media-source-resize</title>
    <script src="media-source-loader.js"></script>
    <script src="../video-test.js"></script>
    <script>
    var loader;
    var source;
    var sourceBuffer;

    function loaderPromise(loader) {
        return new Promise((resolve, reject) => {
            loader.onload = resolve;
            loader.onerror = reject;
        });
    }

    window.addEventListener('load', async event => {
        findMediaElement();

        loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
        await loaderPromise(loader);

        source = new MediaSource();
        run('video.src = URL.createObjectURL(source)');
        await waitFor(source, 'sourceopen');
        waitFor(video, 'error').then(failTest);

        run('sourceBuffer = source.addSourceBuffer(loader.type())');
        run('sourceBuffer.appendBuffer(loader.initSegment())');
        await waitFor(sourceBuffer, 'update');

        consoleWrite('<br>Append all media segments')
        for (i = 0; i < loader.mediaSegmentsLength(); i++) {
            run(`sourceBuffer.appendBuffer(loader.mediaSegment(${i}))`);
            await waitFor(sourceBuffer, 'update');
        }

        consoleWrite('<br>Seek and play')
        let seekTime = 1.6;
        run(`video.currentTime = ${seekTime}`);
        await waitFor(video, 'seeked');
        testExpected('video.currentTime', seekTime);
        run('video.play()');

        consoleWrite('');
        let count = 0;
        waitForEvent('timeupdate', (evt) => {
            testExpected('video.currentTime', seekTime, '>=');

            if (++count == 5) {
                consoleWrite('')
                endTest();
            }
        });
    });

    </script>
</head>
<body>
    <video controls></video>
</body>
</html>