mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 17:58:49 +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:
parent
5424135d81
commit
40c0dd81d2
Notes:
sideshowbarker
2024-07-17 02:08:15 +09:00
Author: https://github.com/trflynn89
Commit: 40c0dd81d2
Pull-request: https://github.com/SerenityOS/serenity/pull/23739
11 changed files with 63 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue