diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
index 54a7f9d15c..c6674a6dbe 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -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> 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(realm, realm));
+}
+
// https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype
WebIDL::ExceptionOr HTMLMediaElement::can_play_type(DeprecatedString const& type) const
{
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h
index d7c62fe867..86846017db 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h
@@ -40,6 +40,8 @@ public:
};
NetworkState network_state() const { return m_network_state; }
+ WebIDL::ExceptionOr> buffered() const;
+
WebIDL::ExceptionOr can_play_type(DeprecatedString const& type) const;
enum class ReadyState : u16 {
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl
index abc874976f..a6acd35800 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl
@@ -1,4 +1,5 @@
#import
+#import
#import
enum CanPlayTypeResult {
@@ -18,6 +19,7 @@ interface HTMLMediaElement : HTMLElement {
const unsigned short NETWORK_LOADING = 2;
const unsigned short NETWORK_NO_SOURCE = 3;
readonly attribute unsigned short networkState;
+ readonly attribute TimeRanges buffered;
undefined load();
CanPlayTypeResult canPlayType(DOMString type);