LibWeb+LibWebView+WebContent: Support muting an entire page

This adds an IPC for chromes to mute a tab. When muted, we trigger an
internal volume change notification and indicate that the user agent has
overriden the media volume.
This commit is contained in:
Timothy Flynn 2024-03-30 09:41:15 -04:00 committed by Andreas Kling
parent 7c31343df0
commit f61f55d397
Notes: sideshowbarker 2024-07-17 02:22:23 +09:00
10 changed files with 68 additions and 2 deletions

View file

@ -438,11 +438,18 @@ void HTMLMediaElement::volume_or_muted_attribute_changed()
on_volume_change();
}
void HTMLMediaElement::page_mute_state_changed(Badge<Page>)
{
on_volume_change();
}
// https://html.spec.whatwg.org/multipage/media.html#effective-media-volume
double HTMLMediaElement::effective_media_volume() const
{
// FIXME 1. If the user has indicated that the user agent is to override the volume of the element, then return the
// volume desired by the user.
// 1. If the user has indicated that the user agent is to override the volume of the element, then return the
// volume desired by the user.
if (document().page().page_mute_state() == MuteState::Muted)
return 0.0;
// 2. If the element's audio output is muted, then return zero.
if (m_muted)