2011-01-14 Jer Noble <jer.noble@apple.com>
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 23:45:05 +0000 (23:45 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 23:45:05 +0000 (23:45 +0000)
        Reviewed by Eric Carlson.

        REGRESSION (r71842): Compass video is not playing in Safari welcome page
        https://bugs.webkit.org/show_bug.cgi?id=52506

        Test that a delay between loading and playing video does not break playback.

        * media/video-currentTime-delay-expected.txt: Added.
        * media/video-currentTime-delay.html: Added.
2011-01-14  Jer Noble  <jer.noble@apple.com>

        Reviewed by Eric Carlson.

        REGRESSION (r71842): Compass video is not playing in Safari welcome page
        https://bugs.webkit.org/show_bug.cgi?id=52506

        New test: LayoutTests/media/video-currentTime-delay.html

        Call invalidateCachedTime() every time one of the cached property dependencies changes,
        i.e. m_paused and m_playbackRate.

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::prepareForLoad):
        (WebCore::HTMLMediaElement::setReadyState):
        (WebCore::HTMLMediaElement::setPlaybackRate):
        (WebCore::HTMLMediaElement::mediaPlayerRateChanged):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76296 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/video-currentTime-delay-expected.txt [new file with mode: 0644]
LayoutTests/media/video-currentTime-delay.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp

index f27e232b3aecbc9b83397917221508a5a484753d..580dbde0215f7a935a87abeb043cce0934a668de 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-14  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Eric Carlson.
+
+        REGRESSION (r71842): Compass video is not playing in Safari welcome page
+        https://bugs.webkit.org/show_bug.cgi?id=52506
+        
+        Test that a delay between loading and playing video does not break playback. 
+
+        * media/video-currentTime-delay-expected.txt: Added.
+        * media/video-currentTime-delay.html: Added.
+
 2011-01-20  Ryosuke Niwa  <rniwa@webkit.org>
 
         Unreviewed Chromium test expectations fix.
diff --git a/LayoutTests/media/video-currentTime-delay-expected.txt b/LayoutTests/media/video-currentTime-delay-expected.txt
new file mode 100644 (file)
index 0000000..58f18cd
--- /dev/null
@@ -0,0 +1,10 @@
+Test a delay in playing the movie results in a canPlay event.
+
+EVENT(canplaythrough)
+EXPECTED (video.currentTime == '0') OK
+RUN(video.currentTime = video.duration - 0.2)
+EVENT(seeked)
+RUN(video.play())
+EVENT(ended)
+END OF TEST
+
diff --git a/LayoutTests/media/video-currentTime-delay.html b/LayoutTests/media/video-currentTime-delay.html
new file mode 100644 (file)
index 0000000..91ce631
--- /dev/null
@@ -0,0 +1,34 @@
+<html>
+<body>
+
+    <video controls></video>
+    
+    <p>Test a delay in playing the movie results in a canPlay event.</p>
+    
+    <script src=media-file.js></script>
+    <script src=video-test.js></script>
+    <script>
+    waitForEvent('canplaythrough',  
+    function () { 
+        waitForEventAndEnd('ended');
+    
+        testExpected("video.currentTime", 0);
+        run("video.currentTime = video.duration - 0.2"); 
+    });
+
+    waitForEvent('seeked',
+    function () {        
+        setTimeout(function() {
+            run("video.play()"); 
+        }, 400);
+    
+        var timeout = 2000;
+        setTimeout(function () { logResult(false, "No 'ended' event in " + timeout/1000  + " seconds"); }, timeout);
+
+    });
+    
+    video.src = findMediaFile("video", "content/test");
+    </script>
+
+</body>
+</html>
index 5f9829db0772539468749f4953af19a602552958..570d83e72eba53908144a0f2c63073a371a01a2d 100644 (file)
@@ -1,3 +1,21 @@
+2011-01-14  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Eric Carlson.
+
+        REGRESSION (r71842): Compass video is not playing in Safari welcome page
+        https://bugs.webkit.org/show_bug.cgi?id=52506
+
+        New test: LayoutTests/media/video-currentTime-delay.html
+
+        Call invalidateCachedTime() every time one of the cached property dependencies changes,
+        i.e. m_paused and m_playbackRate.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::prepareForLoad):
+        (WebCore::HTMLMediaElement::setReadyState):
+        (WebCore::HTMLMediaElement::setPlaybackRate):
+        (WebCore::HTMLMediaElement::mediaPlayerRateChanged):
+
 2011-01-20  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Geoffrey Garen.
index 3a63a3353302fd28e2732e82f120437508d29acf..3149b68e8f5c31ef3ef6671a2ad7d1908e3c9edf 100644 (file)
@@ -540,6 +540,7 @@ void HTMLMediaElement::prepareForLoad()
         refreshCachedTime();
         m_paused = true;
         m_seeking = false;
+        invalidateCachedTime();
         scheduleEvent(eventNames().emptiedEvent);
     }
 
@@ -991,6 +992,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
 
         if (m_autoplaying && m_paused && autoplay()) {
             m_paused = false;
+            invalidateCachedTime();
             scheduleEvent(eventNames().playEvent);
             scheduleEvent(eventNames().playingEvent);
         }
@@ -1300,6 +1302,7 @@ void HTMLMediaElement::setPlaybackRate(float rate)
 
     if (m_playbackRate != rate) {
         m_playbackRate = rate;
+        invalidateCachedTime();
         scheduleEvent(eventNames().ratechangeEvent);
     }
     if (m_player && potentiallyPlaying() && m_player->rate() != rate)
@@ -1404,6 +1407,7 @@ void HTMLMediaElement::playInternal()
     
     if (m_paused) {
         m_paused = false;
+        invalidateCachedTime();
         scheduleEvent(eventNames().playEvent);
 
         if (m_readyState <= HAVE_CURRENT_DATA)
@@ -1891,6 +1895,7 @@ void HTMLMediaElement::mediaPlayerRateChanged(MediaPlayer*)
     // Stash the rate in case the one we tried to set isn't what the engine is
     // using (eg. it can't handle the rate we set)
     m_playbackRate = m_player->rate();
+    invalidateCachedTime();
     endProcessingMediaPlayerCallback();
 }