OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <title>Check multiple buffered timeranges with video preload.</title> |
3 </head> | 3 <script src="../resources/testharness.js"></script> |
4 <body onload="start()"> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <p>Start playing a video with preloading enabled, do a seek near the | 5 <script src="../../media-resources/media-file.js"></script> |
6 end and check multiple buffered timeranges have been created.</p> | 6 <video preload="auto"></video> |
7 <video id="video" preload="auto" autobuffer></video> | |
8 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
9 (Please avoid writing new tests using video-test.js) --> | |
10 <script src=../../media-resources/video-test.js></script> | |
11 <script src=../../media-resources/media-file.js></script> | |
12 <script> | 7 <script> |
13 waitForEvent("ended", ended); | 8 async_test(function(t) { |
14 waitForEventOnce('playing', function() { | 9 var video = document.querySelector("video"); |
15 testExpected("video.buffered.length", 1, "=="); | 10 |
16 run("video.currentTime = video.duration - 0.5"); | 11 video.onended = t.step_func_done(function() { |
| 12 assert_equals(video.buffered.length, 2); |
17 }); | 13 }); |
18 | 14 |
19 function ended() { | 15 video.onplaying = t.step_func(function() { |
20 testExpected("video.buffered.length", 2, "=="); | 16 video.onplaying = null; |
21 endTest(); | 17 video.currentTime = video.duration - 0.5; |
22 } | 18 }); |
23 | 19 |
24 function start () { | 20 // This test needs a large media file to test multiple buffered timeranges. |
25 video = document.getElementById('video'); | 21 var mediaFile = "../../../media/resources/frame_size_change.webm"; |
26 var mediaFile = findMediaFile("audio", "../../../media/content/test"); | 22 var type = mimeTypeForExtension(mediaFile.split(".").pop()); |
27 var type = mimeTypeForExtension(mediaFile.split('.').pop()); | 23 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?nph=1&name
=" + mediaFile + "&throttle=100000&type=" + type; |
28 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?nph=1&
name=" + mediaFile + "&throttle=100&type=" + type; | 24 video.play(); |
29 | 25 }); |
30 video.play(); | 26 </script> |
31 } | |
32 </script> | |
33 </body> | |
34 </html> | |
OLD | NEW |