[MSE] Implement Append Error algorithm.
[WebKit-https.git] / LayoutTests / media / media-source / media-source-append-media-segment-without-init.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title>mock-media-source</title>
5     <script src="mock-media-source.js"></script>
6     <script src="../video-test.js"></script>
7     <script>
8     var source;
9     var sourceBuffer;
10     var initSegment;
11     var wasError = false;
12
13     if (window.internals)
14         internals.initializeMockMediaSource();
15
16     function runTest() {
17         findMediaElement();
18
19         source = new MediaSource();
20         waitForEventOn(source, 'sourceopen', sourceOpen, false, true);
21         run('video.src = URL.createObjectURL(source)');
22     }
23
24     function sourceOpen() {
25         run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
26
27         // Note: In normal usage we should send this line, but this checks what happens if we don't.
28         // initSegment = makeAInit(0, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
29
30         samples = concatenateSamples([
31             makeASample(0, 0, 1, 1, SAMPLE_FLAG.SYNC),
32             makeASample(1, 1, 1, 1, SAMPLE_FLAG.NONE),
33         ]);
34
35         // Note: if code correctly handles sample without init, it will go through Segment Parser Loop
36         // if not, we will receive update event as part of Coded Frame Processing
37         waitForEventOn(sourceBuffer, 'error', null, true, true);
38         failTestIn(2000);
39
40         run('sourceBuffer.appendBuffer(samples)');
41     }
42
43     </script>
44 </head>
45 <body onload="runTest()">
46     <video></video>
47 </body>
48 </html>