2011-04-08 David Humphrey <david.humphrey@senecac.on.ca>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Apr 2011 03:05:18 +0000 (03:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Apr 2011 03:05:18 +0000 (03:05 +0000)
        Reviewed by Eric Carlson.

        Fix call order of media element muted and play(), such that setting muted before play() works.
        https://bugs.webkit.org/show_bug.cgi?id=57673
        https://code.google.com/p/chromium/issues/detail?id=70777

        Manual test added: manual-tests/media-muted.html

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::updatePlayState):
        * manual-tests/media-muted.html: Added.

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

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/manual-tests/media-muted.html [new file with mode: 0644]

index 36a35f7..4a4d5f2 100644 (file)
@@ -1,3 +1,17 @@
+2011-04-08  David Humphrey  <david.humphrey@senecac.on.ca>
+
+        Reviewed by Eric Carlson.
+
+        Fix call order of media element muted and play(), such that setting muted before play() works.
+        https://bugs.webkit.org/show_bug.cgi?id=57673
+        https://code.google.com/p/chromium/issues/detail?id=70777
+
+        Manual test added: manual-tests/media-muted.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updatePlayState):
+        * manual-tests/media-muted.html: Added.
+
 2011-04-08  Nat Duca  <nduca@chromium.org>
 
         Reviewed by David Levin.
index e4e0ec0..4412928 100644 (file)
@@ -2137,9 +2137,11 @@ void HTMLMediaElement::updatePlayState()
             if (!m_isFullscreen && isVideo() && document() && document()->page() && document()->page()->chrome()->requiresFullscreenForVideoPlayback())
                 enterFullscreen();
 
-            // Set rate before calling play in case the rate was set before the media engine was setup.
-            // The media engine should just stash the rate since it isn't already playing.
+            // Set rate, muted before calling play in case they were set before the media engine was setup.
+            // The media engine should just stash the rate and muted values since it isn't already playing.
             m_player->setRate(m_playbackRate);
+            m_player->setMuted(m_muted);
+
             m_player->play();
         }
 
diff --git a/Source/WebCore/manual-tests/media-muted.html b/Source/WebCore/manual-tests/media-muted.html
new file mode 100644 (file)
index 0000000..40e4e41
--- /dev/null
@@ -0,0 +1,32 @@
+<html>
+    <!-- LayoutTests location is hard-coded to avoid duplication of code. -->
+    <script src="http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/media-file.js"></script>
+    <script>
+        var vid;
+
+        function canplaythrough()
+        {
+            vid.play();
+        }
+
+        function load()
+        {
+            vid = document.getElementById('vid');
+            vid.addEventListener('canplaythrough', canplaythrough);
+
+            // Mute first
+            vid.muted = true;
+
+            vid.src = "http://src.chromium.org/svn/trunk/src/chrome/test/data/media/" + findMediaFile("video", "bear");
+        }
+    </script>
+
+    <body>
+        <video id=vid controls autoplay>
+        </video>
+        <p>TEST: Video should be muted (e.g., controls) and also produce no sound (<a href="https://bugs.webkit.org/show_bug.cgi?id=57673">bug 57673</a>).</p>
+        <input type="button" value="Load movie" onclick="load()">
+        <br>
+    </body>
+
+</html>