mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
LibWeb: Implement the HTMLMediaElement paused attribute
Note that the default value of the attribute is true. We were previously autoplaying videos as soon as they loaded - this will prevent that from happening until the paused attribute is set to false.
This commit is contained in:
parent
e130525c24
commit
90921a4f16
5 changed files with 68 additions and 7 deletions
|
@ -45,6 +45,7 @@ public:
|
|||
|
||||
WebIDL::ExceptionOr<void> load();
|
||||
double duration() const;
|
||||
bool paused() const { return m_paused; }
|
||||
void pause() const;
|
||||
|
||||
JS::NonnullGCPtr<VideoTrackList> video_tracks() const { return *m_video_tracks; }
|
||||
|
@ -55,6 +56,11 @@ protected:
|
|||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
// Override in subclasses to handle implementation-specific behavior when the element state changes
|
||||
// to playing or paused, e.g. to start/stop play timers.
|
||||
virtual void on_playing() { }
|
||||
virtual void on_paused() { }
|
||||
|
||||
private:
|
||||
struct EntireResource { };
|
||||
using ByteRange = Variant<EntireResource>; // FIXME: This will need to include "until end" and an actual byte range.
|
||||
|
@ -71,6 +77,9 @@ private:
|
|||
WebIDL::ExceptionOr<void> handle_media_source_failure();
|
||||
void forget_media_resource_specific_tracks();
|
||||
void set_ready_state(ReadyState);
|
||||
|
||||
void notify_about_playing();
|
||||
void set_paused(bool);
|
||||
void set_duration(double);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#media-element-event-task-source
|
||||
|
@ -86,6 +95,9 @@ private:
|
|||
// https://html.spec.whatwg.org/multipage/media.html#dom-media-duration
|
||||
double m_duration { NAN };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-media-paused
|
||||
bool m_paused { true };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks
|
||||
JS::GCPtr<VideoTrackList> m_video_tracks;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue