OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Media Source Player</title> | 4 <title>Media Source Player</title> |
5 </head> | 5 </head> |
6 <body onload="runTest();"> | 6 <body onload="runTest();"> |
7 <video controls></video> | 7 <video controls></video> |
8 <script src="media_utils.js" type="text/javascript"></script> | 8 <script src='eme_player_js/app_loader.js' type='text/javascript'></script> |
9 <script src="media_source_utils.js" type="text/javascript"></script> | |
10 <script type="text/javascript"> | 9 <script type="text/javascript"> |
11 var video = document.querySelector('video'); | 10 var video = document.querySelector('video'); |
12 | 11 |
13 function onTimeUpdate() { | 12 function onTimeUpdate() { |
14 video.removeEventListener('timeupdate', onTimeUpdate); | 13 video.removeEventListener('timeupdate', onTimeUpdate); |
15 video.currentTime = 0.9 * video.duration; | 14 video.currentTime = 0.9 * video.duration; |
16 } | 15 } |
17 | 16 |
18 function onSeeked() { | 17 function onSeeked() { |
19 video.removeEventListener('ended', failTest); | 18 video.removeEventListener('ended', Utils.failTest); |
20 installTitleEventHandler(video, 'ended'); | 19 Utils.installTitleEventHandler(video, 'ended'); |
21 } | 20 } |
22 | 21 |
23 // The test completes after media starts playing, seeks to 0.9 of | 22 // The test completes after media starts playing, seeks to 0.9 of |
24 // duration and fires the ended event. | 23 // duration and fires the ended event. |
25 // The test stops when an error or ended event fire unexpectedly. | 24 // The test stops when an error or ended event fire unexpectedly. |
26 function runTest() { | 25 function runTest() { |
27 loadMediaFromURL(video); | 26 var testConfig = new TestConfig(); |
28 video.addEventListener('ended', failTest); | 27 testConfig.loadQueryParams(); |
| 28 Utils.installTitleEventHandler(video, 'error'); |
| 29 video.addEventListener('ended', Utils.failTest); |
29 video.addEventListener('seeked', onSeeked); | 30 video.addEventListener('seeked', onSeeked); |
30 video.addEventListener('timeupdate', onTimeUpdate); | 31 video.addEventListener('timeupdate', onTimeUpdate); |
| 32 var source = MediaSourceUtils.loadMediaSourceFromTestConfig(testConfig); |
| 33 video.src = window.URL.createObjectURL(source); |
31 video.play(); | 34 video.play(); |
32 } | 35 } |
33 </script> | 36 </script> |
34 </body> | 37 </body> |
35 </html> | 38 </html> |
OLD | NEW |