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 </head> | 7 </head> |
8 <body> | 8 <body> |
9 <script> | 9 <script> |
10 function loadMediaAndVerifyAddedTracks(test, mediaElement, segmentIn
fo, sourceBuffer, mediaData, successCallback) | 10 function loadMediaAndVerifyAddedTracks(test, mediaElement, segmentIn
fo, sourceBuffer, mediaData, successCallback) |
11 { | 11 { |
12 var initSegment = MediaSourceUtil.extractSegmentData(mediaData,
segmentInfo.init); | 12 var initSegment = MediaSourceUtil.extractSegmentData(mediaData,
segmentInfo.init); |
13 test.expectEvent(sourceBuffer.audioTracks, "addtrack", "sourceBu
ffer.audioTracks addtrack event"); | 13 test.expectEvent(sourceBuffer.audioTracks, "addtrack", "sourceBu
ffer.audioTracks addtrack event"); |
14 test.expectEvent(sourceBuffer.videoTracks, "addtrack", "sourceBu
ffer.videoTracks addtrack event"); | 14 test.expectEvent(sourceBuffer.videoTracks, "addtrack", "sourceBu
ffer.videoTracks addtrack event"); |
15 test.expectEvent(mediaElement.audioTracks, "addtrack", "mediaEle
ment.audioTracks addtrack event"); | 15 test.expectEvent(mediaElement.audioTracks, "addtrack", "mediaEle
ment.audioTracks addtrack event"); |
16 test.expectEvent(mediaElement.videoTracks, "addtrack", "mediaEle
ment.videoTracks addtrack event"); | 16 test.expectEvent(mediaElement.videoTracks, "addtrack", "mediaEle
ment.videoTracks addtrack event"); |
17 test.expectEvent(mediaElement, "loadedmetadata", "loadedmetadata
done."); | 17 test.expectEvent(mediaElement, "loadedmetadata", "loadedmetadata
done."); |
18 test.expectEvent(sourceBuffer, "updateend", "initSegment append
ended."); | 18 test.expectEvent(sourceBuffer, "updateend", "initSegment append
ended."); |
19 sourceBuffer.appendBuffer(initSegment); | 19 sourceBuffer.appendBuffer(initSegment); |
20 test.waitForExpectedEvents(function() | 20 test.waitForExpectedEvents(function() |
21 { | 21 { |
22 assert_equals(sourceBuffer.videoTracks.length, 1, "videoTrac
ks.length"); | 22 assert_equals(sourceBuffer.videoTracks.length, 1, "videoTrac
ks.length"); |
23 assert_equals(sourceBuffer.videoTracks[0].kind, "main", "vid
eoTrack.kind"); | 23 assert_equals(sourceBuffer.videoTracks[0].kind, "main", "vid
eoTrack.kind"); |
24 assert_equals(sourceBuffer.videoTracks[0].label, "", "videoT
rack.label"); | 24 assert_equals(sourceBuffer.videoTracks[0].label, "", "videoT
rack.label"); |
25 assert_equals(sourceBuffer.videoTracks[0].language, "eng", "
videoTrack.language"); | 25 assert_equals(sourceBuffer.videoTracks[0].language, "", "vid
eoTrack.language"); |
26 assert_equals(sourceBuffer.videoTracks[0].sourceBuffer, sour
ceBuffer, "videoTrack.sourceBuffer"); | 26 assert_equals(sourceBuffer.videoTracks[0].sourceBuffer, sour
ceBuffer, "videoTrack.sourceBuffer"); |
27 // The first video track is selected by default. | 27 // The first video track is selected by default. |
28 assert_true(sourceBuffer.videoTracks[0].selected, "sourceBuf
fer.videoTracks[0].selected"); | 28 assert_true(sourceBuffer.videoTracks[0].selected, "sourceBuf
fer.videoTracks[0].selected"); |
29 | 29 |
30 assert_equals(sourceBuffer.audioTracks.length, 1, "audioTrac
ks.length"); | 30 assert_equals(sourceBuffer.audioTracks.length, 1, "audioTrac
ks.length"); |
31 assert_equals(sourceBuffer.audioTracks[0].kind, "main", "aud
ioTrack.kind"); | 31 assert_equals(sourceBuffer.audioTracks[0].kind, "main", "aud
ioTrack.kind"); |
32 assert_equals(sourceBuffer.audioTracks[0].label, "", "audioT
rack.label"); | 32 assert_equals(sourceBuffer.audioTracks[0].label, "", "audioT
rack.label"); |
33 assert_equals(sourceBuffer.audioTracks[0].language, "eng", "
audioTrack.language"); | 33 assert_equals(sourceBuffer.audioTracks[0].language, "", "aud
ioTrack.language"); |
34 assert_equals(sourceBuffer.audioTracks[0].sourceBuffer, sour
ceBuffer, "audioTrack.sourceBuffer"); | 34 assert_equals(sourceBuffer.audioTracks[0].sourceBuffer, sour
ceBuffer, "audioTrack.sourceBuffer"); |
35 // The first audio track is enabled by default. | 35 // The first audio track is enabled by default. |
36 assert_true(sourceBuffer.audioTracks[0].enabled, "sourceBuff
er.audioTracks[0].enabled"); | 36 assert_true(sourceBuffer.audioTracks[0].enabled, "sourceBuff
er.audioTracks[0].enabled"); |
37 | 37 |
38 assert_not_equals(sourceBuffer.audioTracks[0].id, sourceBuff
er.videoTracks[0].id, "track ids must be unique"); | 38 assert_not_equals(sourceBuffer.audioTracks[0].id, sourceBuff
er.videoTracks[0].id, "track ids must be unique"); |
39 | 39 |
40 assert_equals(mediaElement.videoTracks.length, 1, "videoTrac
ks.length"); | 40 assert_equals(mediaElement.videoTracks.length, 1, "videoTrac
ks.length"); |
41 assert_equals(mediaElement.videoTracks[0], sourceBuffer.vide
oTracks[0], "mediaElement.videoTrack == sourceBuffer.videoTrack"); | 41 assert_equals(mediaElement.videoTracks[0], sourceBuffer.vide
oTracks[0], "mediaElement.videoTrack == sourceBuffer.videoTrack"); |
42 | 42 |
43 assert_equals(mediaElement.audioTracks.length, 1, "audioTrac
ks.length"); | 43 assert_equals(mediaElement.audioTracks.length, 1, "audioTrac
ks.length"); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 { | 117 { |
118 mediaElement.load(); | 118 mediaElement.load(); |
119 }), test.step_func_done()); | 119 }), test.step_func_done()); |
120 })); | 120 })); |
121 }, "Media tracks must be removed when the HTMLMediaElement.load() is
called"); | 121 }, "Media tracks must be removed when the HTMLMediaElement.load() is
called"); |
122 | 122 |
123 </script> | 123 </script> |
124 </body> | 124 </body> |
125 </html> | 125 </html> |
126 | 126 |
OLD | NEW |