pub struct HTMLMediaElement {
Show 36 fields htmlelement: HTMLElement, network_state: Cell<NetworkState>, ready_state: Cell<ReadyState>, src_object: DomRefCell<Option<SrcObject>>, current_src: DomRefCell<String>, generation_id: Cell<u32>, fired_loadeddata_event: Cell<bool>, error: MutNullableDom<MediaError>, paused: Cell<bool>, defaultPlaybackRate: Cell<f64>, playbackRate: Cell<f64>, autoplaying: Cell<bool>, delaying_the_load_event_flag: DomRefCell<Option<LoadBlocker>>, pending_play_promises: DomRefCell<Vec<Rc<Promise>>>, in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, Result<(), Error>)>>, player: DomRefCell<Option<Arc<Mutex<dyn Player>>>>, video_renderer: Arc<Mutex<MediaFrameRenderer>>, audio_renderer: DomRefCell<Option<Arc<Mutex<dyn AudioRenderer>>>>, show_poster: Cell<bool>, duration: Cell<f64>, playback_position: Cell<f64>, default_playback_start_position: Cell<f64>, volume: Cell<f64>, seeking: Cell<bool>, muted: Cell<bool>, resource_url: DomRefCell<Option<ServoUrl>>, blob_url: DomRefCell<Option<ServoUrl>>, played: DomRefCell<TimeRangesContainer>, audio_tracks_list: MutNullableDom<AudioTrackList>, video_tracks_list: MutNullableDom<VideoTrackList>, text_tracks_list: MutNullableDom<TextTrackList>, next_timeupdate_event: Cell<Timespec>, current_fetch_context: DomRefCell<Option<HTMLMediaElementFetchContext>>, id: Cell<u64>, media_controls_id: DomRefCell<Option<String>>, player_context: WindowGLContext,


htmlelement: HTMLElementnetwork_state: Cell<NetworkState>ready_state: Cell<ReadyState>src_object: DomRefCell<Option<SrcObject>>current_src: DomRefCell<String>generation_id: Cell<u32>

Incremented whenever tasks associated with this element are cancelled.

fired_loadeddata_event: Cell<bool>


Reset to false every time the load algorithm is invoked.

error: MutNullableDom<MediaError>paused: Cell<bool>defaultPlaybackRate: Cell<f64>playbackRate: Cell<f64>autoplaying: Cell<bool>delaying_the_load_event_flag: DomRefCell<Option<LoadBlocker>>pending_play_promises: DomRefCell<Vec<Rc<Promise>>>in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, Result<(), Error>)>>

Play promises which are soon to be fulfilled by a queued task.

player: DomRefCell<Option<Arc<Mutex<dyn Player>>>>video_renderer: Arc<Mutex<MediaFrameRenderer>>audio_renderer: DomRefCell<Option<Arc<Mutex<dyn AudioRenderer>>>>show_poster: Cell<bool>


duration: Cell<f64>


playback_position: Cell<f64>


default_playback_start_position: Cell<f64>


volume: Cell<f64>


seeking: Cell<bool>


muted: Cell<bool>


resource_url: DomRefCell<Option<ServoUrl>>

URL of the media resource, if any.

blob_url: DomRefCell<Option<ServoUrl>>

URL of the media resource, if the resource is set through the src_object attribute and it is a blob.

played: DomRefCell<TimeRangesContainer>


audio_tracks_list: MutNullableDom<AudioTrackList>video_tracks_list: MutNullableDom<VideoTrackList>text_tracks_list: MutNullableDom<TextTrackList>


next_timeupdate_event: Cell<Timespec>

Time of last timeupdate notification.

current_fetch_context: DomRefCell<Option<HTMLMediaElementFetchContext>>

Latest fetch request context.

id: Cell<u64>

Player Id reported the player thread

media_controls_id: DomRefCell<Option<String>>

Media controls id. In order to workaround the lack of privileged JS context, we secure the the access to the “privileged” document.servoGetMediaControls(id) API by keeping a whitelist of media controls identifiers.

player_context: WindowGLContext


Marks that element as delaying the load event or not.

Nothing happens if the element was already delaying the load event and we pass true to that method again.



Queues a task to run the dedicated media source failure steps.

Appends a promise to the list of pending play promises.

Takes the pending play promises.

The result with which these promises will be fulfilled is passed here and this method returns nothing because we actually just move the current list of pending play promises to the in_flight_play_promises_queue field.

Each call to this method must be followed by a call to fulfill_in_flight_play_promises, to actually fulfill the promises which were taken and moved to the in-flight queue.

Fulfills the next in-flight play promises queue after running a closure.

See the comment on take_pending_play_promises for why this method does not take a list of promises to fulfill. Callers cannot just pop the front list off of in_flight_play_promises_queue and later fulfill the promises because that would mean putting #[allow(unrooted_must_root)] on even more functions, potentially hiding actual safety bugs.


By default the audio is rendered through the audio sink automatically selected by the servo-media Player instance. However, in some cases, like the WebAudio MediaElementAudioSourceNode, we need to set a custom audio renderer.

Trait Implementations

Check whether a DOM object implements one of its deriving interfaces.
Cast a DOM object upwards to one of the interfaces it derives from.
Cast a DOM object downwards to one of the interfaces it might implement.
Returns the receiver’s reflector.
Returns the global scope of the realm that the DomObject was created in.
Executes the destructor for this type. Read more





This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is

Returns whether the given DOM class derives that interface.
Trace self.
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
Initializes the Reflector
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Convert self to a JSVal. JSAPI failure causes a panic.
Returns self as the superclass of the implementation for this trait, if any. Read more
Called when a Node is removed from a tree, where ‘tree_connected’ indicates whether the tree is part of a Document. Implements removing steps: https://dom.spec.whatwg.org/#concept-node-remove-ext Read more
Returns true if given attribute attr affects style of the given element. Read more
Returns the right AttrValue variant for the attribute with name name on this element. Read more
Called when a Node is appended to a tree, where ‘tree_connected’ indicates whether the tree is part of a Document. Read more
Called on the parent when its children are changed.
Called during event dispatch after the bubbling phase completes.
Called on an element when it is popped off the stack of open elements of a parser. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more