| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="/w3c/resources/testharness.js"></script> |
| 5 <script src="/w3c/resources/testharnessreport.js"></script> |
| 6 <script src="mediasource-util.js"></script> |
| 7 </head> |
| 8 <body> |
| 9 <script> |
| 10 mediasource_testafterdataloaded(function(test, mediaElement, mediaSo
urce, segmentInfo, sourceBuffer, mediaData) |
| 11 { |
| 12 assert_greater_than(segmentInfo.media.length, 3, "at least 3 med
ia segments for supported type"); |
| 13 test.failOnEvent(mediaElement, "error"); |
| 14 sourceBuffer.mode = "sequence"; |
| 15 assert_equals(sourceBuffer.mode, "sequence", "mode after setting
it to 'sequence'"); |
| 16 |
| 17 // Append all media segments, preceded by a (now redundant) init
ialization segment. |
| 18 test.expectEvent(sourceBuffer, "updatestart", "media segment app
end started."); |
| 19 test.expectEvent(sourceBuffer, "update", "media segment append s
uccess."); |
| 20 test.expectEvent(sourceBuffer, "updateend", "media segment appen
d ended."); |
| 21 sourceBuffer.appendBuffer(mediaData); |
| 22 |
| 23 test.waitForExpectedEvents(function() |
| 24 { |
| 25 // Remove much of what we just appended. |
| 26 test.expectEvent(sourceBuffer, "updatestart", "remove starte
d."); |
| 27 test.expectEvent(sourceBuffer, "update", "remove success."); |
| 28 test.expectEvent(sourceBuffer, "updateend", "remove ended.")
; |
| 29 sourceBuffer.remove(segmentInfo.media[3].timecode, mediaSour
ce.duration); |
| 30 }); |
| 31 |
| 32 test.waitForExpectedEvents(function() |
| 33 { |
| 34 // Set the timestampOffset to the beginning of the region we
just removed. |
| 35 sourceBuffer.timestampOffset = segmentInfo.media[3].timecode
; |
| 36 |
| 37 // Remove everything. |
| 38 test.expectEvent(sourceBuffer, "updatestart", "remove starte
d."); |
| 39 test.expectEvent(sourceBuffer, "update", "remove success."); |
| 40 test.expectEvent(sourceBuffer, "updateend", "remove ended.")
; |
| 41 sourceBuffer.remove(0, mediaSource.duration); |
| 42 }); |
| 43 |
| 44 test.waitForExpectedEvents(function() |
| 45 { |
| 46 // Set the timestampOffset back to the beginning. |
| 47 sourceBuffer.timestampOffset = 0; |
| 48 |
| 49 // Re-append everything. |
| 50 test.expectEvent(sourceBuffer, "updatestart", "media segment
append started."); |
| 51 test.expectEvent(sourceBuffer, "update", "media segment appe
nd success."); |
| 52 test.expectEvent(sourceBuffer, "updateend", "media segment a
ppend ended."); |
| 53 sourceBuffer.appendBuffer(mediaData); |
| 54 }); |
| 55 |
| 56 test.waitForExpectedEvents(function() |
| 57 { |
| 58 // Use EOS to get a more precisely verifiable buffered range
given our segmentInfo. |
| 59 test.expectEvent(mediaSource, "sourceended", "mediaSource en
dOfStream"); |
| 60 mediaSource.endOfStream(); |
| 61 }); |
| 62 |
| 63 test.waitForExpectedEvents(function() |
| 64 { |
| 65 assertBufferedEquals(sourceBuffer, "{ [0.000, " + segmentInf
o.duration.toFixed(3) + ") }"); |
| 66 test.done(); |
| 67 }); |
| 68 }, "Test no error for sequence mode remove and timestampOffset scena
rio in bug 616565"); |
| 69 </script> |
| 70 </body> |
| 71 </html> |
| OLD | NEW |