mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Implement setting media element's network state to Loading
This commit is contained in:
committed by
Gregory Bertilson
parent
a3a3e604c5
commit
b84473ff1d
Notes:
github-actions[bot]
2026-02-27 04:04:40 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/b84473ff1d4 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8179 Reviewed-by: https://github.com/shannonbooth Reviewed-by: https://github.com/trflynn89
@@ -1534,19 +1534,24 @@ void HTMLMediaElement::set_up_playback_manager(NonnullRefPtr<FetchData> const& f
|
||||
// https://html.spec.whatwg.org/multipage/media.html#media-data-processing-steps-list
|
||||
void HTMLMediaElement::process_media_data(FetchingStatus fetching_status)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
// -> Once the entire media resource has been fetched (but potentially before any of it has been decoded)
|
||||
if (fetching_status == FetchingStatus::Complete) {
|
||||
// Fire an event named progress at the media element.
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::progress));
|
||||
dispatch_event(DOM::Event::create(realm, HTML::EventNames::progress));
|
||||
|
||||
// Set the networkState to NETWORK_IDLE and fire an event named suspend at the media element.
|
||||
m_network_state = NetworkState::Idle;
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::suspend));
|
||||
dispatch_event(DOM::Event::create(realm, HTML::EventNames::suspend));
|
||||
} else if (fetching_status == FetchingStatus::Ongoing) {
|
||||
// If the user agent ever discards any media data and then needs to resume the network activity to obtain it again, then it must queue a media
|
||||
// element task given the media element to set the networkState to NETWORK_LOADING.
|
||||
queue_a_media_element_task(GC::weak_callback(*this, [](auto& self) {
|
||||
self.m_network_state = NetworkState::Loading;
|
||||
}));
|
||||
}
|
||||
|
||||
// FIXME: If the user agent ever discards any media data and then needs to resume the network activity to obtain it again, then it must queue a media
|
||||
// element task given the media element to set the networkState to NETWORK_LOADING.
|
||||
|
||||
// FIXME: -> If the connection is interrupted after some media data has been received, causing the user agent to give up trying to fetch the resource
|
||||
// FIXME: -> If the media data fetching process is aborted by the user
|
||||
// FIXME: -> If the media data can be fetched but has non-fatal errors or uses, in part, codecs that are unsupported, preventing the user agent from
|
||||
|
||||
Reference in New Issue
Block a user