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 <script src='/media/resources/media-source/webm/segment-info.js'></scrip t> | |
8 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | |
9 </head> | |
10 <body> | |
11 <div id='log'></div> | |
12 | |
13 <script> | |
14 | |
15 function seekBackAfterPlayingTest(testFunction, description, options ) | |
16 { | |
17 mediasource_test(function(test, mediaElement, mediaSource) | |
18 { | |
19 var segmentInfo = WebMSegmentInfo.testWebM; | |
20 assert_equals(segmentInfo.duration, 6.042, 'Expected test medi a duration'); | |
21 test.failOnEvent(mediaElement, 'error'); | |
22 | |
23 var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.typ e); | |
24 MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function (mediaData) | |
25 { | |
26 testFunction(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData); | |
27 }); | |
28 }, description, options); | |
29 } | |
30 | |
31 function getSegment(mediaData, info) | |
32 { | |
33 var start = info.offset; | |
34 var end = start + info.size; | |
35 return mediaData.subarray(start, end); | |
36 } | |
37 | |
38 seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, s egmentInfo, sourceBuffer, mediaData) | |
39 { | |
40 test.failOnEvent(mediaElement, 'error'); | |
acolwell GONE FROM CHROMIUM
2013/07/25 23:11:31
nit: You shouldn't need this here since you have t
anandc
2013/07/26 18:49:22
Done.
| |
41 | |
42 mediaElement.play(); | |
43 // Append all the segments | |
44 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); | |
45 test.expectEvent(mediaElement, 'playing', 'Playing triggered'); | |
46 sourceBuffer.appendBuffer(mediaData); | |
47 | |
48 function playAndSeek(test, mediaElement) | |
49 { | |
50 test.waitForExpectedEvents(function() | |
51 { | |
52 assert_greater_than(mediaElement.currentTime, 0.0, | |
acolwell GONE FROM CHROMIUM
2013/07/25 23:11:31
nit: put this all one one line.
anandc
2013/07/26 18:49:22
Done.
| |
53 'Playback has started.'); | |
anandc
2013/07/25 22:50:13
This is the assert that is failing.
| |
54 test.expectEvent(mediaElement, 'seeking', 'mediaElement' ); | |
55 mediaElement.currentTime = 0.0; | |
56 assert_true(mediaElement.seeking, 'mediaElement is seeki ng'); | |
57 }); | |
58 | |
59 test.waitForExpectedEvents(function() | |
60 { | |
61 assert_equals(mediaElement.currentTime, 0.0, 'Current ti me is 0.0'); | |
62 test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fired.'); | |
63 test.expectEvent(mediaElement, 'seeked', 'mediaElement f inished seek'); | |
64 }); | |
65 | |
66 test.waitForExpectedEvents(function() | |
67 { | |
68 assert_true(mediaElement.waiting, 'mediaElement is waiti ng'); | |
69 test.done(); | |
70 }); | |
71 | |
72 } | |
73 | |
74 setTimeout(playAndSeek(test, mediaElement), 2000); | |
acolwell GONE FROM CHROMIUM
2013/07/25 23:11:31
this calls playAndSeek() immediately. It isn't wai
anandc
2013/07/26 18:49:22
Thanks. Done.
| |
75 | |
76 }, 'Test playing then seeking back.'); | |
77 </script> | |
78 </body> | |
79 </html> | |
OLD | NEW |