1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 15:38:12 +00:00

LibWeb: Stub out the HTMLMediaElement buffered attribute

This is needed by https://store.steampowered.com. For now, we return an
empty TimeRanges object.
This commit is contained in:
Timothy Flynn 2023-04-18 16:22:34 -04:00 committed by Andreas Kling
parent 680a9f748e
commit 7833b321a3
3 changed files with 18 additions and 0 deletions

View file

@ -22,6 +22,7 @@
#include <LibWeb/HTML/HTMLVideoElement.h>
#include <LibWeb/HTML/PotentialCORSRequest.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/TimeRanges.h>
#include <LibWeb/HTML/TrackEvent.h>
#include <LibWeb/HTML/VideoTrack.h>
#include <LibWeb/HTML/VideoTrackList.h>
@ -92,6 +93,19 @@ void HTMLMediaElement::parse_attribute(DeprecatedFlyString const& name, Deprecat
load_element().release_value_but_fixme_should_propagate_errors();
}
// https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered
WebIDL::ExceptionOr<JS::NonnullGCPtr<TimeRanges>> HTMLMediaElement::buffered() const
{
auto& realm = this->realm();
auto& vm = realm.vm();
// 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. Users agents
// must accurately determine the ranges available, even for media streams where this can only be determined by
// tedious inspection.
return TRY(vm.heap().allocate<TimeRanges>(realm, realm));
}
// https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype
WebIDL::ExceptionOr<Bindings::CanPlayTypeResult> HTMLMediaElement::can_play_type(DeprecatedString const& type) const
{