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) | |
wolenetz
2013/08/02 21:41:37
nit: Indentation (4 spaces).
anandc
2013/08/02 22:37:48
Done.
| |
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) | |
wolenetz
2013/08/02 21:41:37
nit: Remove unused function.
anandc
2013/08/02 22:37:48
Huh. Done.
| |
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 | |
41 mediaElement.play(); | |
42 // Append all the segments | |
43 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); | |
44 test.expectEvent(mediaElement, 'playing', 'Playing triggered'); | |
45 sourceBuffer.appendBuffer(mediaData); | |
46 | |
47 var playTimeoutHandler = test.step_func(function() | |
48 { | |
49 assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.'); | |
50 test.expectEvent(mediaElement, 'seeking', 'mediaElement'); | |
51 mediaElement.currentTime = 0.0; | |
52 | |
53 test.waitForExpectedEvents(function() | |
54 { | |
55 assert_true(mediaElement.seeking, 'mediaElement is seeki ng'); | |
56 assert_equals(mediaElement.currentTime, 0.0, 'Current ti me is 0.0'); | |
57 test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fired.'); | |
58 test.expectEvent(mediaElement, 'seeked', 'mediaElement f inished seek'); | |
59 var playAfterSeekHandler = test.step_func(function() | |
60 { | |
61 assert_greater_than(mediaElement.currentTime, 0.0, 'Pl ayback has started after seek.'); | |
62 test.done(); | |
63 }); | |
64 test.expectDelayedCallback(playAfterSeekHandler, 300); | |
wolenetz
2013/08/02 21:41:37
More than a nit:
This line needs to be done only a
anandc
2013/08/02 22:37:48
Thanks for the thorough review and explanations. I
| |
65 }); | |
66 | |
67 }); | |
68 | |
69 test.waitForExpectedEvents(function() | |
70 { | |
71 test.expectDelayedCallback(playTimeoutHandler, 300); | |
72 }); | |
73 | |
74 }, 'Test playing then seeking back.'); | |
75 </script> | |
76 </body> | |
77 </html> | |
OLD | NEW |