Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / media / test / data / media_source_player.html
blob319907c5228d59edbfaa6fee1eec24dc5ffe7d3e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Media Source Player</title>
5 </head>
6 <body onload="runTest();">
7 <video controls></video>
8 <script src='eme_player_js/app_loader.js' type='text/javascript'></script>
9 <script type="text/javascript">
10 var video = document.querySelector('video');
12 function onTimeUpdate() {
13 video.removeEventListener('timeupdate', onTimeUpdate);
14 video.currentTime = 0.9 * video.duration;
17 function onSeeked() {
18 video.removeEventListener('ended', Utils.failTest);
19 Utils.installTitleEventHandler(video, 'ended');
22 // For those streams whose start time is greater than
23 // kSeekToStartFudgeRoom defined in source_buffer_stream.cc, we
24 // need to skip those time range. Otherwise it won't play
25 function onLoadedMetaData() {
26 var buf = video.buffered;
27 if (buf.length > 0) {
28 video.currentTime = buf.start(0);
32 // The test completes after media starts playing, seeks to 0.9 of
33 // duration and fires the ended event.
34 // The test stops when an error or ended event fire unexpectedly.
35 function runTest() {
36 var testConfig = new TestConfig();
37 testConfig.loadQueryParams();
38 Utils.installTitleEventHandler(video, 'error');
39 video.addEventListener('ended', Utils.failTest);
40 video.addEventListener('seeked', onSeeked);
41 video.addEventListener('timeupdate', onTimeUpdate);
42 video.addEventListener('loadedmetadata', onLoadedMetaData);
43 var source = MediaSourceUtils.loadMediaSourceFromTestConfig(testConfig);
44 video.src = window.URL.createObjectURL(source);
45 video.play();
47 </script>
48 </body>
49 </html>