Title: [96082] trunk
Revision
96082
Author
[email protected]
Date
2011-09-27 01:33:21 -0700 (Tue, 27 Sep 2011)

Log Message

Audio element doesn't emit the 'playing' event every time it starts playing, after it has finished playing.
https://bugs.webkit.org/show_bug.cgi?id=60972

Patch by Arun Patole <[email protected]> on 2011-09-27
Reviewed by Philippe Normand.

Source/WebCore:

The paused attribute should be set to true and the media element should emit a 'paused' at the end of playback.
WHATWG revision r6562: http://html5.org/tools/web-apps-tracker?from=6561&to=6562

Test: media/media-element-play-after-eos.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged): set m_paused to true and schedule 'pause' event when playback ended.

LayoutTests:

Update media tests as the 'pause' event should be fired
and 'paused' should be set to true at the end of playback.

* media/event-attributes-expected.txt:
* media/event-attributes.html:
* media/media-element-play-after-eos-expected.txt: Added.
* media/media-element-play-after-eos.html: Added.
* media/video-loop-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96081 => 96082)


--- trunk/LayoutTests/ChangeLog	2011-09-27 08:21:06 UTC (rev 96081)
+++ trunk/LayoutTests/ChangeLog	2011-09-27 08:33:21 UTC (rev 96082)
@@ -1,3 +1,19 @@
+2011-09-27  Arun Patole  <[email protected]>
+
+        Audio element doesn't emit the 'playing' event every time it starts playing, after it has finished playing.
+        https://bugs.webkit.org/show_bug.cgi?id=60972
+
+        Reviewed by Philippe Normand.
+
+        Update media tests as the 'pause' event should be fired
+        and 'paused' should be set to true at the end of playback.
+
+        * media/event-attributes-expected.txt:
+        * media/event-attributes.html:
+        * media/media-element-play-after-eos-expected.txt: Added.
+        * media/media-element-play-after-eos.html: Added.
+        * media/video-loop-expected.txt:
+
 2011-09-27  Philippe Normand  <[email protected]>
 
         Unreviewed, GTK gardening.

Modified: trunk/LayoutTests/media/event-attributes-expected.txt (96081 => 96082)


--- trunk/LayoutTests/media/event-attributes-expected.txt	2011-09-27 08:21:06 UTC (rev 96081)
+++ trunk/LayoutTests/media/event-attributes-expected.txt	2011-09-27 08:33:21 UTC (rev 96082)
@@ -32,6 +32,7 @@
 RUN(video.play())
 EVENT(play)
 EVENT(playing)
+EVENT(pause)
 EVENT(ended)
 
 *** played to end, setting 'src' to an invalid movie

Modified: trunk/LayoutTests/media/event-attributes.html (96081 => 96082)


--- trunk/LayoutTests/media/event-attributes.html	2011-09-27 08:21:06 UTC (rev 96081)
+++ trunk/LayoutTests/media/event-attributes.html	2011-09-27 08:33:21 UTC (rev 96082)
@@ -7,6 +7,7 @@
             var ratechangeCount = 0;
             var playingCount = 0;
             var progressEventCount = 0;
+            var pauseEventCount = 0;
 
             function eventHandler()
             {
@@ -38,8 +39,10 @@
                         run("video.pause()");
                         break;
                     case "pause":
-                        consoleWrite("<br>*** seeking");
-                        run("video.currentTime = 5.6");
+                        if(++pauseEventCount == 1) {
+                            consoleWrite("<br>*** seeking");
+                            run("video.currentTime = 5.6");
+                        }
                         break;
                     case "seeked":
                         consoleWrite("<br>*** beginning playback");

Added: trunk/LayoutTests/media/media-element-play-after-eos-expected.txt (0 => 96082)


--- trunk/LayoutTests/media/media-element-play-after-eos-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/media-element-play-after-eos-expected.txt	2011-09-27 08:33:21 UTC (rev 96082)
@@ -0,0 +1,16 @@
+This tests ensure that media element emits the 'playing' event every time it starts playing after eos. It also ensure that 'pause' and 'ended' events are sent when media playback ends.
+
+RUN(mediaElement.play())
+EVENT(playing)
+EVENT(pause)
+EXPECTED (mediaElement.paused == 'true') OK
+EVENT(ended)
+EXPECTED (mediaElement.ended == 'true') OK
+RUN(mediaElement.play())
+EVENT(playing)
+EVENT(pause)
+EXPECTED (mediaElement.paused == 'true') OK
+EVENT(ended)
+EXPECTED (mediaElement.ended == 'true') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/media-element-play-after-eos.html (0 => 96082)


--- trunk/LayoutTests/media/media-element-play-after-eos.html	                        (rev 0)
+++ trunk/LayoutTests/media/media-element-play-after-eos.html	2011-09-27 08:33:21 UTC (rev 96082)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <script src=""
+        <script>
+            var repeated = false;
+            var mediaElement = new Audio();
+
+            function start()
+            {
+                mediaElement.src = "" 'content/silence');
+                run("mediaElement.play()");
+                waitForEvent("playing", mediaPlaying);
+                waitForEvent("pause", mediaPause);
+                waitForEvent("ended", mediaEnded);
+            }
+
+            function mediaPlaying()
+            {
+                mediaElement.currentTime = mediaElement.duration - 0.2;
+            }
+
+            function mediaPause()
+            {
+                testExpected("mediaElement.paused", true);
+            }
+
+            function mediaEnded()
+            {
+                testExpected("mediaElement.ended", true);
+ 
+                if (repeated)
+                    endTest();
+ 
+                run("mediaElement.play()");
+                repeated = true;
+            }
+
+        </script>
+    </head>
+    <body _onload_="start()">
+        <p>This tests ensure that media element emits the 'playing' event every time it starts playing after eos. It also ensure that 'pause' and 'ended' events are sent when media playback ends.</p>
+    </body>
+</html>
+

Modified: trunk/LayoutTests/media/video-loop-expected.txt (96081 => 96082)


--- trunk/LayoutTests/media/video-loop-expected.txt	2011-09-27 08:21:06 UTC (rev 96081)
+++ trunk/LayoutTests/media/video-loop-expected.txt	2011-09-27 08:33:21 UTC (rev 96082)
@@ -52,6 +52,7 @@
 RUN(video.play())
 
 EVENT(play)
+EVENT(pause)
 EVENT(ended)
 
 ++ played to end and stopped.

Modified: trunk/Source/WebCore/ChangeLog (96081 => 96082)


--- trunk/Source/WebCore/ChangeLog	2011-09-27 08:21:06 UTC (rev 96081)
+++ trunk/Source/WebCore/ChangeLog	2011-09-27 08:33:21 UTC (rev 96082)
@@ -1,3 +1,18 @@
+2011-09-27  Arun Patole  <[email protected]>
+
+        Audio element doesn't emit the 'playing' event every time it starts playing, after it has finished playing.
+        https://bugs.webkit.org/show_bug.cgi?id=60972
+
+        Reviewed by Philippe Normand.
+
+        The paused attribute should be set to true and the media element should emit a 'paused' at the end of playback.
+        WHATWG revision r6562: http://html5.org/tools/web-apps-tracker?from=6561&to=6562
+
+        Test: media/media-element-play-after-eos.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): set m_paused to true and schedule 'pause' event when playback ended.
+
 2011-09-27  Rakesh KN  <[email protected]>
 
         <input> with autofocus doesn't lose focus when it has a certain onblur listener

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (96081 => 96082)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-09-27 08:21:06 UTC (rev 96081)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-09-27 08:33:21 UTC (rev 96082)
@@ -2139,6 +2139,10 @@
             m_sentEndEvent = false;
             seek(0, ignoredException);
         } else {
+            if (!m_paused) {
+                m_paused = true;
+                scheduleEvent(eventNames().pauseEvent);
+            }
             if (!m_sentEndEvent) {
                 m_sentEndEvent = true;
                 scheduleEvent(eventNames().endedEvent);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to