blob: 1be9f7c1a1779155a21ee5a5ceb61bca44f79636 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>mock-media-source</title>
<script src="mock-media-source.js"></script>
<script src="../video-test.js"></script>
<script>
var source;
var sourceBuffer;
var initSegment;
var sample;
if (window.internals)
internals.initializeMockMediaSource();
function runTest()
{
findMediaElement();
source = new MediaSource();
testExpected('source.readyState', 'closed');
waitForEventOn(source, 'sourceopen', sourceOpen);
video.src = URL.createObjectURL(source);
}
function sourceOpen()
{
run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
waitForEventOn(sourceBuffer, 'updateend', loadSamples, false, true);
initSegment = makeAInit(100, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
run('sourceBuffer.appendBuffer(initSegment)');
}
function loadSamples()
{
sample = makeASample(0, 0, 10, 1, 1, SAMPLE_FLAG.SYNC);
waitForEventOn(sourceBuffer, 'updateend', play, false, true);
run('sourceBuffer.appendBuffer(sample)');
}
function play()
{
waitForEventTestAndEnd('waiting', 'video.readyState == HTMLMediaElement.HAVE_CURRENT_DATA');
run('video.play()');
}
</script>
</head>
<body onload="runTest()">
<video></video>
</body>
</html>