mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibWeb: Add a stub for HTMLMediaElement.played()
This commit is contained in:
parent
0206697d36
commit
3952ff4786
Notes:
github-actions[bot]
2025-02-18 17:46:36 +00:00
Author: https://github.com/Psychpsyo
Commit: 3952ff4786
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3563
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 14 additions and 1 deletions
|
@ -173,6 +173,18 @@ GC::Ref<TimeRanges> HTMLMediaElement::buffered() const
|
||||||
return realm.create<TimeRanges>(realm);
|
return realm.create<TimeRanges>(realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/media.html#dom-media-played
|
||||||
|
GC::Ref<TimeRanges> HTMLMediaElement::played() const
|
||||||
|
{
|
||||||
|
auto& realm = this->realm();
|
||||||
|
|
||||||
|
// The played attribute must return a new static normalized TimeRanges object that represents the ranges of points on the media timeline of the media resource reached through the
|
||||||
|
// usual monotonic increase of the current playback position during normal playback, if any, at the time the attribute is evaluated.
|
||||||
|
auto time_ranges = realm.create<TimeRanges>(realm);
|
||||||
|
// FIXME: Actually add the correct ranges
|
||||||
|
return time_ranges;
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype
|
// https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype
|
||||||
Bindings::CanPlayTypeResult HTMLMediaElement::can_play_type(StringView type) const
|
Bindings::CanPlayTypeResult HTMLMediaElement::can_play_type(StringView type) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
NetworkState network_state() const { return m_network_state; }
|
NetworkState network_state() const { return m_network_state; }
|
||||||
|
|
||||||
[[nodiscard]] GC::Ref<TimeRanges> buffered() const;
|
[[nodiscard]] GC::Ref<TimeRanges> buffered() const;
|
||||||
|
[[nodiscard]] GC::Ref<TimeRanges> played() const;
|
||||||
|
|
||||||
static inline constexpr auto supported_video_subtypes = Array {
|
static inline constexpr auto supported_video_subtypes = Array {
|
||||||
"webm"sv,
|
"webm"sv,
|
||||||
|
|
|
@ -62,7 +62,7 @@ interface HTMLMediaElement : HTMLElement {
|
||||||
attribute double defaultPlaybackRate;
|
attribute double defaultPlaybackRate;
|
||||||
attribute double playbackRate;
|
attribute double playbackRate;
|
||||||
[FIXME] attribute boolean preservesPitch;
|
[FIXME] attribute boolean preservesPitch;
|
||||||
[FIXME] readonly attribute TimeRanges played;
|
readonly attribute TimeRanges played;
|
||||||
[FIXME] readonly attribute TimeRanges seekable;
|
[FIXME] readonly attribute TimeRanges seekable;
|
||||||
readonly attribute boolean ended;
|
readonly attribute boolean ended;
|
||||||
[Reflect, CEReactions] attribute boolean autoplay;
|
[Reflect, CEReactions] attribute boolean autoplay;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue