mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Expose PlaybackManager's buffered range on the media element
This commit is contained in:
committed by
Gregory Bertilson
parent
f3832c0b36
commit
6034a93c83
Notes:
github-actions[bot]
2026-04-01 07:57:22 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/6034a93c831 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8655 Reviewed-by: https://github.com/tcl3
@@ -237,11 +237,15 @@ GC::Ref<TimeRanges> HTMLMediaElement::buffered() const
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
|
||||
// FIXME: The buffered attribute must return a new static normalized TimeRanges object that represents the ranges of the
|
||||
// media resource, if any, that the user agent has buffered, at the time the attribute is evaluated. User agents
|
||||
// must accurately determine the ranges available, even for media streams where this can only be determined by
|
||||
// tedious inspection.
|
||||
return realm.create<TimeRanges>(realm);
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered
|
||||
// The buffered attribute must return a new static normalized TimeRanges object that represents the ranges of the
|
||||
// media resource, if any, that the user agent has buffered, at the time the attribute is evaluated.
|
||||
auto time_ranges = realm.create<TimeRanges>(realm);
|
||||
if (m_playback_manager) {
|
||||
for (auto const& range : m_playback_manager->buffered_time_ranges())
|
||||
time_ranges->add_range(range.start.to_seconds_f64(), range.end.to_seconds_f64());
|
||||
}
|
||||
return time_ranges;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-media-played
|
||||
|
||||
Reference in New Issue
Block a user