mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 01:42:54 +00:00
LibWeb: Don't attempt to notify chromes about audio playing until ready
The current location of the IPC invocation is often too soon. We reach it before the audio file has completely finished downloading / loading, thus there isn't an AudioTrack object yet. Instead, wait until we are actually playing the audio to invoke the IPC. This is particularly frequent on bandcamp.
This commit is contained in:
parent
0df7f5bcfc
commit
2393ee6548
Notes:
sideshowbarker
2024-07-17 17:49:11 +09:00
Author: https://github.com/trflynn89
Commit: 2393ee6548
Pull-request: https://github.com/SerenityOS/serenity/pull/23769
1 changed files with 9 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2023-2024, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -1578,6 +1578,9 @@ void HTMLMediaElement::notify_about_playing()
|
|||
});
|
||||
|
||||
on_playing();
|
||||
|
||||
if (m_audio_tracks->has_enabled_track())
|
||||
document().page().client().page_did_change_audio_play_state(AudioPlayState::Playing);
|
||||
}
|
||||
|
||||
void HTMLMediaElement::set_show_poster(bool show_poster)
|
||||
|
@ -1598,15 +1601,16 @@ void HTMLMediaElement::set_paused(bool paused)
|
|||
|
||||
m_paused = paused;
|
||||
|
||||
if (m_paused)
|
||||
if (m_paused) {
|
||||
on_paused();
|
||||
|
||||
if (m_audio_tracks->has_enabled_track())
|
||||
document().page().client().page_did_change_audio_play_state(AudioPlayState::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