RESOLVED FIXED 137305
Calling WebCore::Page::setMediaVolume(0) does not mute videos as expected
https://bugs.webkit.org/show_bug.cgi?id=137305
Summary Calling WebCore::Page::setMediaVolume(0) does not mute videos as expected
Ada Chan
Reported 2014-10-01 11:25:29 PDT
I have a simple test page with a video element in it: <div id=target style="border: solid;"> <video src="http://movies.apple.com/movies/us/apple/ipoditunes/2007/touch/ads/apple_ipodtouch_touch_r640-9cie.mov" autoplay controls></video> </div> I set the page's media volume to 0 with WKPageSetMediaVolume(0). But I can still hear the video playing. Looking at HTMLMediaElement::updateVolume(), it looks like the volume multiplier is only applied if m_volumeInitialized is true, and in this case it's not.
Attachments
Patch (2.50 KB, patch)
2014-10-21 15:48 PDT, Ada Chan
darin: review+
Radar WebKit Bug Importer
Comment 1 2014-10-10 13:32:55 PDT
Ada Chan
Comment 2 2014-10-21 10:42:50 PDT
Looks like this was broken in http://trac.webkit.org/changeset/154970.
Eric Carlson
Comment 3 2014-10-21 11:20:30 PDT
Removing the "if (m_volumeInitialized)" check in HTMLMediaElement::updateVolume will fix this problem, and I don't *think* it will change the GStreamer behavior because MediaPlayerPrivateGStreamerBase::setStreamVolumeElement does nothing unless m_volumeInitialized is true (HTMLMediaElement::mediaPlayerPlatformVolumeConfigurationRequired).
Philippe Normand
Comment 4 2014-10-21 14:03:11 PDT
Sorry for the breakage :( Looking at r154970 too, I agree with Eric that it should be enough to remove the "if (m_volumeInitialized)" test from ::updateVolume()
Ada Chan
Comment 5 2014-10-21 15:48:46 PDT
Created attachment 240225 [details] Patch Please let me know if there's a way to write a test for this.
Eric Carlson
Comment 6 2014-10-21 17:04:59 PDT
(In reply to comment #5) > Created attachment 240225 [details] > Patch > > Please let me know if there's a way to write a test for this. > I don't think there is a way to add a test for this change, because any problems will only happen to users of the GTK port with some versions of pulse audio. You might be able to add a test for Page::setMediaVolume to ensure that it isn't broken in the future, but that will require fairly invasive changes so I am not sure it is worth while.
Ada Chan
Comment 7 2014-10-21 17:19:22 PDT
Eric and Philippe: thanks for your help! Committed: http://trac.webkit.org/changeset/175003
Note You need to log in before you can comment on or make changes to this bug.