mirror of
https://github.com/RGBCube/serenity
synced 2025-07-22 11:47:35 +00:00
LibWeb: Implement HTMLMediaElement's networkState attribute
This commit is contained in:
parent
9a370a5eed
commit
6d5893a121
2 changed files with 18 additions and 0 deletions
|
@ -16,6 +16,14 @@ class HTMLMediaElement : public HTMLElement {
|
||||||
public:
|
public:
|
||||||
virtual ~HTMLMediaElement() override;
|
virtual ~HTMLMediaElement() override;
|
||||||
|
|
||||||
|
enum class NetworkState : u16 {
|
||||||
|
Empty,
|
||||||
|
Idle,
|
||||||
|
Loading,
|
||||||
|
NoSource,
|
||||||
|
};
|
||||||
|
NetworkState network_state() const { return m_network_state; }
|
||||||
|
|
||||||
Bindings::CanPlayTypeResult can_play_type(DeprecatedString const& type) const;
|
Bindings::CanPlayTypeResult can_play_type(DeprecatedString const& type) const;
|
||||||
|
|
||||||
void load() const;
|
void load() const;
|
||||||
|
@ -25,6 +33,10 @@ protected:
|
||||||
HTMLMediaElement(DOM::Document&, DOM::QualifiedName);
|
HTMLMediaElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
||||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// https://html.spec.whatwg.org/multipage/media.html#dom-media-networkstate
|
||||||
|
NetworkState m_network_state { NetworkState::Empty };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,13 @@ enum CanPlayTypeResult {
|
||||||
[Exposed=Window]
|
[Exposed=Window]
|
||||||
interface HTMLMediaElement : HTMLElement {
|
interface HTMLMediaElement : HTMLElement {
|
||||||
|
|
||||||
|
// network state
|
||||||
[Reflect, CEReactions] attribute DOMString src;
|
[Reflect, CEReactions] attribute DOMString src;
|
||||||
|
const unsigned short NETWORK_EMPTY = 0;
|
||||||
|
const unsigned short NETWORK_IDLE = 1;
|
||||||
|
const unsigned short NETWORK_LOADING = 2;
|
||||||
|
const unsigned short NETWORK_NO_SOURCE = 3;
|
||||||
|
readonly attribute unsigned short networkState;
|
||||||
|
|
||||||
[Reflect, CEReactions] attribute boolean autoplay;
|
[Reflect, CEReactions] attribute boolean autoplay;
|
||||||
[Reflect, CEReactions] attribute boolean loop;
|
[Reflect, CEReactions] attribute boolean loop;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue