OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="/w3c/resources/testharness.js"></script> | 4 <script src="/w3c/resources/testharness.js"></script> |
5 <script src="/w3c/resources/testharnessreport.js"></script> | 5 <script src="/w3c/resources/testharnessreport.js"></script> |
6 <script src="mediasource-util.js"></script> | 6 <script src="mediasource-util.js"></script> |
7 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | 7 <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <div id="log"></div> | 10 <div id="log"></div> |
11 <script> | 11 <script> |
12 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour
ce, segmentInfo, sourceBuffer, mediaData) | 12 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour
ce, segmentInfo, sourceBuffer, mediaData) |
13 { | 13 { |
14 test.failOnEvent(mediaElement, 'error'); | 14 test.failOnEvent(mediaElement, 'error'); |
15 | 15 |
16 assert_false(sourceBuffer.updating, "sourceBuffer.updating"); | 16 assert_false(sourceBuffer.updating, "sourceBuffer.updating"); |
17 | 17 |
18 sourceBuffer.appendBuffer(mediaData); | 18 sourceBuffer.appendBuffer(mediaData); |
19 | 19 |
20 assert_true(sourceBuffer.updating, "sourceBuffer.updating"); | 20 assert_true(sourceBuffer.updating, "sourceBuffer.updating"); |
21 test.expectEvent(sourceBuffer, "updateend"); | 21 test.expectEvent(sourceBuffer, "updateend"); |
22 | 22 |
23 test.waitForExpectedEvents(function() | 23 test.waitForExpectedEvents(function() |
24 { | 24 { |
25 assert_false(sourceBuffer.updating, "sourceBuffer.updating"); | 25 assert_false(sourceBuffer.updating, "sourceBuffer.updating"); |
26 | 26 |
27 mediaSource.duration = 1; | 27 // Truncate the buffered media to about 1 second duration. |
| 28 sourceBuffer.remove(1, +Infinity); |
28 | 29 |
29 assert_true(sourceBuffer.updating, "sourceBuffer.updating"); | 30 assert_true(sourceBuffer.updating, "sourceBuffer.updating"); |
30 test.expectEvent(sourceBuffer, "updateend"); | 31 test.expectEvent(sourceBuffer, "updateend"); |
31 }); | 32 }); |
32 | 33 |
33 test.waitForExpectedEvents(function() | 34 test.waitForExpectedEvents(function() |
34 { | 35 { |
35 mediaSource.endOfStream(); | 36 mediaSource.endOfStream(); |
36 mediaElement.play(); | 37 mediaElement.play(); |
37 | 38 |
38 test.endOnEvent(mediaElement, 'ended'); | 39 test.endOnEvent(mediaElement, 'ended'); |
39 }); | 40 }); |
40 | 41 |
41 }, "Test normal playback case with MediaSource API", {timeout: 5000}); | 42 }, "Test normal playback case with MediaSource API", {timeout: 5000}); |
42 </script> | 43 </script> |
43 </body> | 44 </body> |
44 </html> | 45 </html> |
OLD | NEW |