Title: [178655] trunk
- Revision
- 178655
- Author
- adac...@apple.com
- Date
- 2015-01-19 10:50:55 -0800 (Mon, 19 Jan 2015)
Log Message
HTMLMediaElement::isPlayingAudio() should return false if the element is explicitly muted by script.
https://bugs.webkit.org/show_bug.cgi?id=140524
Reviewed by Andreas Kling.
Source/WebCore:
Test: media/muted-video-is-playing-audio.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setMuted):
Call Document::updateIsPlayingAudio() to recalculate the overall audio playing state.
(WebCore::HTMLMediaElement::isPlayingAudio):
HTMLMediaElement::isPlayingAudio() should return false if the media element is explicitly muted.
LayoutTests:
The test contains a looping video. It makes sure initially Page::isPlayingAudio() returns true.
It should return false after the video is muted, and true again after the video is unmuted.
* media/muted-video-is-playing-audio-expected.txt: Added.
* media/muted-video-is-playing-audio.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (178654 => 178655)
--- trunk/LayoutTests/ChangeLog 2015-01-19 18:40:47 UTC (rev 178654)
+++ trunk/LayoutTests/ChangeLog 2015-01-19 18:50:55 UTC (rev 178655)
@@ -1,3 +1,16 @@
+2015-01-16 Ada Chan <adac...@apple.com>
+
+ HTMLMediaElement::isPlayingAudio() should return false if the element is explicitly muted by script.
+ https://bugs.webkit.org/show_bug.cgi?id=140524
+
+ Reviewed by Andreas Kling.
+
+ The test contains a looping video. It makes sure initially Page::isPlayingAudio() returns true.
+ It should return false after the video is muted, and true again after the video is unmuted.
+
+ * media/muted-video-is-playing-audio-expected.txt: Added.
+ * media/muted-video-is-playing-audio.html: Added.
+
2015-01-19 Myles C. Maxfield <mmaxfi...@apple.com>
[SVG -> OTF Converter] Flip the switch on
Added: trunk/LayoutTests/media/muted-video-is-playing-audio-expected.txt (0 => 178655)
--- trunk/LayoutTests/media/muted-video-is-playing-audio-expected.txt (rev 0)
+++ trunk/LayoutTests/media/muted-video-is-playing-audio-expected.txt 2015-01-19 18:50:55 UTC (rev 178655)
@@ -0,0 +1,15 @@
+Testing that muting a video element should result in page's audio playing state to become false
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.internals.isPagePlayingAudio() became true
+PASS window.internals.isPagePlayingAudio() became false
+PASS window.internals.isPagePlayingAudio() became true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+RUN(video.muted = true)
+RUN(video.muted = false)
+
Added: trunk/LayoutTests/media/muted-video-is-playing-audio.html (0 => 178655)
--- trunk/LayoutTests/media/muted-video-is-playing-audio.html (rev 0)
+++ trunk/LayoutTests/media/muted-video-is-playing-audio.html 2015-01-19 18:50:55 UTC (rev 178655)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src=""
+ </head>
+ <body>
+ <video src="" controls autoplay loop></video>
+ <script src=""
+ <script src=""
+ <script>
+ description("Testing that muting a video element should result in page's audio playing state to become false");
+
+ jsTestIsAsync = true;
+
+ function testUnmutingVideo()
+ {
+ run("video.muted = false");
+ shouldBecomeEqual("window.internals.isPagePlayingAudio()", "true", finishJSTest);
+ }
+
+ function testMutingVideo()
+ {
+ run("video.muted = true");
+ shouldBecomeEqual("window.internals.isPagePlayingAudio()", "false", testUnmutingVideo);
+ }
+
+ shouldBecomeEqual("window.internals.isPagePlayingAudio()", "true", testMutingVideo);
+ </script>
+ <script src=""
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (178654 => 178655)
--- trunk/Source/WebCore/ChangeLog 2015-01-19 18:40:47 UTC (rev 178654)
+++ trunk/Source/WebCore/ChangeLog 2015-01-19 18:50:55 UTC (rev 178655)
@@ -1,3 +1,18 @@
+2015-01-16 Ada Chan <adac...@apple.com>
+
+ HTMLMediaElement::isPlayingAudio() should return false if the element is explicitly muted by script.
+ https://bugs.webkit.org/show_bug.cgi?id=140524
+
+ Reviewed by Andreas Kling.
+
+ Test: media/muted-video-is-playing-audio.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setMuted):
+ Call Document::updateIsPlayingAudio() to recalculate the overall audio playing state.
+ (WebCore::HTMLMediaElement::isPlayingAudio):
+ HTMLMediaElement::isPlayingAudio() should return false if the media element is explicitly muted.
+
2015-01-19 Myles C. Maxfield <mmaxfi...@apple.com>
[SVG -> OTF Converter] Flip the switch on
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (178654 => 178655)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-01-19 18:40:47 UTC (rev 178654)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-01-19 18:50:55 UTC (rev 178655)
@@ -3033,6 +3033,7 @@
}
}
scheduleEvent(eventNames().volumechangeEvent);
+ document().updateIsPlayingAudio();
}
#endif
}
@@ -6107,7 +6108,7 @@
bool HTMLMediaElement::isPlayingAudio()
{
- return isPlaying() && hasAudio();
+ return isPlaying() && hasAudio() && !muted();
}
void HTMLMediaElement::pageMutedStateDidChange()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes