LibMedia+LibWeb: Implement media volume/muting

This commit is contained in:
Zaggy1024 2025-09-27 16:02:48 -05:00 committed by Jelle Raaijmakers
parent e176249db8
commit 8d9a493b1b
Notes: github-actions[bot] 2025-10-28 00:34:20 +00:00
6 changed files with 34 additions and 2 deletions

View file

@ -454,12 +454,12 @@ void HTMLMediaElement::volume_or_muted_attribute_changed()
if (auto* paintable = this->paintable())
paintable->set_needs_display();
// FIXME: Set the volume on the PlaybackManager.
update_volume();
}
void HTMLMediaElement::page_mute_state_changed(Badge<Page>)
{
// FIXME: Set the volume on the PlaybackManager.
update_volume();
}
// https://html.spec.whatwg.org/multipage/media.html#effective-media-volume
@ -484,6 +484,12 @@ double HTMLMediaElement::effective_media_volume() const
return volume;
}
void HTMLMediaElement::update_volume()
{
if (m_playback_manager)
m_playback_manager->set_volume(effective_media_volume());
}
// https://html.spec.whatwg.org/multipage/media.html#dom-media-addtexttrack
GC::Ref<TextTrack> HTMLMediaElement::add_text_track(Bindings::TextTrackKind kind, String const& label, String const& language)
{