Title: [127949] trunk
- Revision
- 127949
- Author
- v...@chromium.org
- Date
- 2012-09-07 18:28:44 -0700 (Fri, 07 Sep 2012)
Log Message
Seek to end after duration change in HTMLMediaElement
https://bugs.webkit.org/show_bug.cgi?id=95986
Reviewed by Eric Carlson.
This seeks the media element to the end of the media resource if the current playback
position has become greater than the duration after a duration change.
http://dev.w3.org/html5/spec/media-elements.html#durationChange
Source/WebCore:
Test: http/tests/media/media-source/seek-to-end-after-duration-change.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerDurationChanged): After firing the duration change event, checks to see if current time exceeds duration and if so, seeks to duration.
LayoutTests:
* http/tests/media/media-source/seek-to-end-after-duration-change-expected.txt: Added.
* http/tests/media/media-source/seek-to-end-after-duration-change.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (127948 => 127949)
--- trunk/LayoutTests/ChangeLog 2012-09-08 01:22:54 UTC (rev 127948)
+++ trunk/LayoutTests/ChangeLog 2012-09-08 01:28:44 UTC (rev 127949)
@@ -1,3 +1,17 @@
+2012-09-07 Victoria Kirst <v...@chromium.org>
+
+ Seek to end after duration change in HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=95986
+
+ Reviewed by Eric Carlson.
+
+ This seeks the media element to the end of the media resource if the current playback
+ position has become greater than the duration after a duration change.
+ http://dev.w3.org/html5/spec/media-elements.html#durationChange
+
+ * http/tests/media/media-source/seek-to-end-after-duration-change-expected.txt: Added.
+ * http/tests/media/media-source/seek-to-end-after-duration-change.html: Added.
+
2012-09-07 Dominic Mazzoni <dmazz...@google.com>
AX: WebCore accessibility roles should be cross-platform
Added: trunk/LayoutTests/http/tests/media/media-source/seek-to-end-after-duration-change-expected.txt (0 => 127949)
--- trunk/LayoutTests/http/tests/media/media-source/seek-to-end-after-duration-change-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-source/seek-to-end-after-duration-change-expected.txt 2012-09-08 01:28:44 UTC (rev 127949)
@@ -0,0 +1,10 @@
+Test that the video tag seeks to the end of the file if duration is truncated before the current playback position.
+
+EVENT(webkitsourceopen)
+EVENT(loadeddata)
+EVENT(seeked)
+EVENT(durationchange)
+EVENT(seeking)
+EVENT(seeked)
+END OF TEST
+
Added: trunk/LayoutTests/http/tests/media/media-source/seek-to-end-after-duration-change.html (0 => 127949)
--- trunk/LayoutTests/http/tests/media/media-source/seek-to-end-after-duration-change.html (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-source/seek-to-end-after-duration-change.html 2012-09-08 01:28:44 UTC (rev 127949)
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script src=""
+ <script>
+ var segmentHelper = new MediaSourceTest.SegmentHelper(WebMSegmentInfo.testWebM, true);
+
+ function onSourceOpen()
+ {
+ segmentHelper.addSourceBuffer();
+ waitForEventOnce('loadeddata', onLoadedData, false);
+ segmentHelper.appendInitSegment();
+ segmentHelper.appendAllMediaSegments();
+ }
+
+ function onLoadedData()
+ {
+ waitForEventOnce('seeked', onExplicitSeek, false);
+ video.currentTime = 3;
+ }
+
+ function onExplicitSeek()
+ {
+ var currentTime = video.currentTime;
+ if (currentTime != 3) {
+ failTest("Seeked to " + currentTime + " instead of 3");
+ return;
+ }
+
+ waitForEventOnce('durationchange', onDurationChange, false);
+ mediaSource.duration = 2;
+ }
+
+ function onDurationChange()
+ {
+ MediaSourceTest.expectDuration(video, mediaSource, 2);
+ waitForEventOnce('seeking', function() {
+ waitForEventOnce('seeked', onSeekToEnd, false);
+ mediaSource.endOfStream();
+ }, false);
+ }
+
+ function onSeekToEnd()
+ {
+ var currentTime = video.currentTime;
+ var duration = video.duration;
+ if (currentTime != duration) {
+ failTest("Seeked to " + currentTime + " instead of " + duration);
+ return;
+ }
+ endTest();
+ }
+
+ function onLoad()
+ {
+ findMediaElement();
+
+ mediaSource = new WebKitMediaSource();
+ waitForEvent('webkitsourceopen', onSourceOpen, false, false, mediaSource);
+
+ segmentHelper.init(video, function(success) {
+ if (!success) {
+ failTest("Failed to load segment data");
+ return;
+ }
+ MediaSourceTest.setSrcToMediaSourceTestURL(video);
+ });
+ }
+ </script>
+ </head>
+ <body _onload_="onLoad()">
+ <video> </video>
+ <p>Test that the video tag seeks to the end of the file if duration is truncated before the current playback position.</p>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (127948 => 127949)
--- trunk/Source/WebCore/ChangeLog 2012-09-08 01:22:54 UTC (rev 127948)
+++ trunk/Source/WebCore/ChangeLog 2012-09-08 01:28:44 UTC (rev 127949)
@@ -1,3 +1,19 @@
+2012-09-07 Victoria Kirst <v...@chromium.org>
+
+ Seek to end after duration change in HTMLMediaElement
+ https://bugs.webkit.org/show_bug.cgi?id=95986
+
+ Reviewed by Eric Carlson.
+
+ This seeks the media element to the end of the media resource if the current playback
+ position has become greater than the duration after a duration change.
+ http://dev.w3.org/html5/spec/media-elements.html#durationChange
+
+ Test: http/tests/media/media-source/seek-to-end-after-duration-change.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerDurationChanged): After firing the duration change event, checks to see if current time exceeds duration and if so, seeks to duration.
+
2012-09-07 James Robinson <jam...@chromium.org>
[chromium] Implement WebCompositorInputHandlerImpl on top of exposed API instead of CC internals
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (127948 => 127949)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-09-08 01:22:54 UTC (rev 127948)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-09-08 01:28:44 UTC (rev 127949)
@@ -3258,8 +3258,16 @@
LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged");
beginProcessingMediaPlayerCallback();
+
scheduleEvent(eventNames().durationchangeEvent);
mediaPlayerCharacteristicChanged(player);
+
+ float now = currentTime();
+ float dur = duration();
+ ExceptionCode ignoredException;
+ if (now > dur)
+ seek(dur, ignoredException);
+
endProcessingMediaPlayerCallback();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes