4 <script src="/media-resources/video-test.js"></script>
5 <script src="/media/resources/media-source/webm/segment-info.js"></script>
6 <script src="webkitmediasource-util.js"></script>
8 var segmentHelper = new MediaSourceTest.SegmentHelper(WebMSegmentInfo.testWebM, true);
10 function onSourceOpen()
12 segmentHelper.addSourceBuffer();
13 waitForEventOnce('loadeddata', onLoadedData, false);
14 segmentHelper.appendInitSegment();
15 segmentHelper.appendAllMediaSegments();
18 function onLoadedData()
20 waitForEventOnce('seeked', onExplicitSeek, false);
21 video.currentTime = 3;
24 function onExplicitSeek()
26 var currentTime = video.currentTime;
27 if (currentTime != 3) {
28 failTest("Seeked to " + currentTime + " instead of 3");
32 waitForEventOnce('durationchange', onDurationChange, false);
33 mediaSource.duration = 2;
36 function onDurationChange()
38 MediaSourceTest.expectDuration(video, mediaSource, 2);
39 waitForEventOnce('seeking', function() {
40 waitForEventOnce('seeked', onSeekToEnd, false);
41 mediaSource.endOfStream();
45 function onSeekToEnd()
47 var currentTime = video.currentTime;
48 var duration = video.duration;
49 if (currentTime != duration) {
50 failTest("Seeked to " + currentTime + " instead of " + duration);
60 mediaSource = new WebKitMediaSource();
61 waitForEvent('webkitsourceopen', onSourceOpen, false, false, mediaSource);
63 segmentHelper.init(video, function(success) {
65 failTest("Failed to load segment data");
68 MediaSourceTest.setSrcToMediaSourceTestURL(video);
73 <body onload="onLoad()">
75 <p>Test that the video tag seeks to the end of the file if duration is truncated before the current playback position.</p>