| <!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 samples; |
| |
| if (window.internals) |
| internals.initializeMockMediaSource(); |
| |
| window.addEventListener('load', async event => { |
| findMediaElement(); |
| |
| source = new MediaSource(); |
| run('video.src = URL.createObjectURL(source)'); |
| await waitFor(source, 'sourceopen'); |
| |
| run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")'); |
| initSegment = makeAInit(8, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]); |
| run('sourceBuffer.appendBuffer(initSegment)'); |
| await waitFor(sourceBuffer, 'updateend'); |
| |
| run('internals.setMaximumQueueDepthForTrackID(sourceBuffer, 1, 3)'); |
| |
| samples = concatenateSamples([ |
| makeASample(0, 0, 1, 1, 1, SAMPLE_FLAG.SYNC), |
| makeASample(2, 1, 1, 1, 1, SAMPLE_FLAG.NONE), |
| makeASample(3, 2, 1, 1, 1, SAMPLE_FLAG.NONE), |
| makeASample(1, 3, 1, 1, 1, SAMPLE_FLAG.NONE), |
| makeASample(4, 4, 1, 1, 1, SAMPLE_FLAG.SYNC), |
| makeASample(5, 5, 1, 1, 1, SAMPLE_FLAG.NONE), |
| makeASample(6, 6, 1, 1, 1, SAMPLE_FLAG.NONE), |
| makeASample(8, 7, 1, 1, 1, SAMPLE_FLAG.NONE), |
| ]); |
| |
| run('sourceBuffer.appendBuffer(samples)'); |
| await waitFor(sourceBuffer, 'updateend'); |
| |
| testExpected('internals.minimumUpcomingPresentationTimeForTrackID(sourceBuffer, 1)', 1); |
| |
| run('video.currentTime = 4'); |
| await waitFor(video, 'seeked'); |
| |
| testExpected('internals.minimumUpcomingPresentationTimeForTrackID(sourceBuffer, 1)', 8); |
| |
| samples = makeASample(7, 8, 1, 1, 1, SAMPLE_FLAG.NONE), |
| |
| run('sourceBuffer.appendBuffer(samples)'); |
| await waitFor(sourceBuffer, 'updateend'); |
| |
| testExpected('internals.minimumUpcomingPresentationTimeForTrackID(sourceBuffer, 1)', 7); |
| |
| endTest(); |
| }); |
| |
| </script> |
| </head> |
| <body> |
| <video></video> |
| </body> |
| </html> |