blob: cd477eb90cab4232f85cd649314775ea0b8c67f8 [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 wasError = false;
if (window.internals)
internals.initializeMockMediaSource();
function runTest() {
findMediaElement();
source = new MediaSource();
waitForEventOn(source, 'sourceopen', sourceOpen, false, true);
run('video.src = URL.createObjectURL(source)');
}
function sourceOpen() {
run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
// Note: In normal usage we should send this line, but this checks what happens if we don't.
// initSegment = makeAInit(0, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
samples = concatenateSamples([
makeASample(0, 0, 1, 1, 1, SAMPLE_FLAG.SYNC),
makeASample(1, 1, 1, 1, 1, SAMPLE_FLAG.NONE),
]);
// Note: if code correctly handles sample without init, it will go through Segment Parser Loop
// if not, we will receive update event as part of Coded Frame Processing
waitForEventOn(sourceBuffer, 'error', null, true, true);
failTestIn(2000);
run('sourceBuffer.appendBuffer(samples)');
}
</script>
</head>
<body onload="runTest()">
<video></video>
</body>
</html>