mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-21 07:06:04 +00:00
LibWeb+LibWebView+WebContent: Inform chromes when audio is played/paused
Most browsers have some indicator when audio is playing in a tab, which makes it easier to find that tab and mute unwanted audio. This adds an IPC to allow the Ladybird chromes to do something similar.
This commit is contained in:
committed by
Andreas Kling
parent
5424135d81
commit
40c0dd81d2
@@ -18,6 +18,7 @@
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchController.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/HTML/AudioPlayState.h>
|
||||
#include <LibWeb/HTML/AudioTrack.h>
|
||||
#include <LibWeb/HTML/AudioTrackList.h>
|
||||
#include <LibWeb/HTML/CORSSettingAttribute.h>
|
||||
@@ -35,6 +36,7 @@
|
||||
#include <LibWeb/HTML/VideoTrackList.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/MimeSniff/MimeType.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Painting/Paintable.h>
|
||||
#include <LibWeb/WebIDL/Promise.h>
|
||||
|
||||
@@ -1602,6 +1604,9 @@ void HTMLMediaElement::set_paused(bool paused)
|
||||
if (auto* paintable = this->paintable())
|
||||
paintable->set_needs_display();
|
||||
set_needs_style_update(true);
|
||||
|
||||
if (m_audio_tracks->has_enabled_track())
|
||||
document().page().client().page_did_change_audio_play_state(paused ? AudioPlayState::Paused : AudioPlayState::Playing);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#blocked-media-element
|
||||
|
||||
Reference in New Issue
Block a user