#[repr(C)]
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<Instant>, current_fetch_context: DomRefCell<Option<HTMLMediaElementFetchContext>>, id: Cell<u64>, media_controls_id: DomRefCell<Option<String>>, player_context: WindowGLContext,
}

Fields§

§htmlelement: HTMLElement§network_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>

https://html.spec.whatwg.org/multipage/#fire-loadeddata

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<Instant>

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

Implementations§

source§

impl HTMLMediaElement

source

pub fn new_inherited( tag_name: LocalName, prefix: Option<Prefix>, document: &Document ) -> Self

source

pub fn get_ready_state(&self) -> ReadyState

source

fn media_type_id(&self) -> HTMLMediaElementTypeId

source

fn play_media(&self)

source

pub fn delay_load_event(&self, delay: bool)

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.

https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag

source

fn time_marches_on(&self)

source

fn internal_pause_steps(&self)

source

fn is_allowed_to_play(&self) -> bool

source

fn notify_about_playing(&self)

source

fn change_ready_state(&self, ready_state: ReadyState)

source

fn invoke_resource_selection_algorithm(&self)

source

fn resource_selection_algorithm_sync(&self, base_url: ServoUrl)

source

fn fetch_request(&self, offset: Option<u64>, seek_lock: Option<SeekLock>)

source

fn resource_fetch_algorithm(&self, resource: Resource)

source

fn queue_dedicated_media_source_failure_steps(&self)

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

source

fn queue_ratechange_event(&self)

source

fn is_potentially_playing(&self) -> bool

source

fn is_blocked_media_element(&self) -> bool

source

fn is_paused_for_user_interaction(&self) -> bool

source

fn is_paused_for_in_band_content(&self) -> bool

source

fn media_element_load_algorithm(&self)

source

fn push_pending_play_promise(&self, promise: &Rc<Promise>)

Appends a promise to the list of pending play promises.

source

fn take_pending_play_promises(&self, result: Result<(), Error>)

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.

source

fn fulfill_in_flight_play_promises<F>(&self, f: F)where F: FnOnce(),

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(crown::unrooted_must_root)] on even more functions, potentially hiding actual safety bugs.

source

pub fn handle_source_child_insertion(&self)

source

fn seek(&self, time: f64, _approximate_for_speed: bool)

source

fn seek_end(&self)

source

pub fn process_poster_image_loaded(&self, image: Arc<Image>)

source

fn setup_media_player(&self, resource: &Resource) -> Result<(), ()>

source

pub fn set_audio_track(&self, idx: usize, enabled: bool)

source

pub fn set_video_track(&self, idx: usize, enabled: bool)

source

fn handle_player_event(&self, event: &PlayerEvent)

source

fn earliest_possible_position(&self) -> f64

source

fn render_controls(&self)

source

fn remove_controls(&self)

source

pub fn get_current_frame(&self) -> Option<VideoFrame>

source

pub fn set_audio_renderer(&self, audio_renderer: Arc<Mutex<dyn AudioRenderer>>)

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.

source

fn send_media_session_event(&self, event: MediaSessionEvent)

source

pub fn set_duration(&self, duration: f64)

source

fn set_show_poster(&self, show_poster: bool)

Sets a new value for the show_poster propperty. If the poster is being hidden because new frames should render, updates video_renderer to allow it.

source

pub fn reset(&self)

source§

impl HTMLMediaElement

Trait Implementations§

source§

impl Castable for HTMLMediaElement

source§

fn is<T>(&self) -> boolwhere T: DerivedFrom<Self>,

Check whether a DOM object implements one of its deriving interfaces.
source§

fn upcast<T>(&self) -> &Twhere T: Castable, Self: DerivedFrom<T>,

Cast a DOM object upwards to one of the interfaces it derives from.
source§

fn downcast<T>(&self) -> Option<&T>where T: DerivedFrom<Self>,

Cast a DOM object downwards to one of the interfaces it might implement.
source§

impl DomObject for HTMLMediaElement

source§

fn reflector(&self) -> &Reflector

Returns the receiver’s reflector.
source§

fn global(&self) -> Root<Dom<GlobalScope>>where Self: Sized,

Returns the global scope of the realm that the DomObject was created in.
source§

impl Drop for HTMLMediaElement

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl HTMLMediaElementMethods for HTMLMediaElement

source§

fn GetDefaultPlaybackRate(&self) -> Result<Finite<f64>, Error>

source§

fn SetDefaultPlaybackRate(&self, value: Finite<f64>) -> Result<(), Error>

source§

fn GetPlaybackRate(&self) -> Result<Finite<f64>, Error>

source§

fn SetPlaybackRate(&self, value: Finite<f64>) -> Result<(), Error>

source§

fn NetworkState(&self) -> u16

source§

fn ReadyState(&self) -> u16

source§

fn Autoplay(&self) -> bool

source§

fn SetAutoplay(&self, value: bool)

source§

fn Loop(&self) -> bool

source§

fn SetLoop(&self, value: bool)

source§

fn DefaultMuted(&self) -> bool

source§

fn SetDefaultMuted(&self, value: bool)

source§

fn Controls(&self) -> bool

source§

fn SetControls(&self, value: bool)

source§

fn Src(&self) -> USVString

source§

fn SetSrc(&self, value: USVString)

source§

fn GetCrossOrigin(&self) -> Option<DOMString>

source§

fn SetCrossOrigin(&self, value: Option<DOMString>)

source§

fn Muted(&self) -> bool

source§

fn SetMuted(&self, value: bool)

source§

fn GetSrcObject(&self) -> Option<MediaStreamOrBlob>

source§

fn SetSrcObject(&self, value: Option<MediaStreamOrBlob>)

source§

fn Preload(&self) -> DOMString

source§

fn SetPreload(&self, value: DOMString)

source§

fn CurrentSrc(&self) -> USVString

source§

fn Load(&self)

source§

fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult

source§

fn GetError(&self) -> Option<Root<Dom<MediaError>>>

source§

fn Play(&self, comp: InRealm<'_>) -> Rc<Promise>

source§

fn Pause(&self)

source§

fn Paused(&self) -> bool

source§

fn Duration(&self) -> f64

source§

fn CurrentTime(&self) -> Finite<f64>

source§

fn SetCurrentTime(&self, time: Finite<f64>)

source§

fn Seeking(&self) -> bool

source§

fn Ended(&self) -> bool

source§

fn FastSeek(&self, time: Finite<f64>)

source§

fn Played(&self) -> Root<Dom<TimeRanges>>

source§

fn Buffered(&self) -> Root<Dom<TimeRanges>>

source§

fn AudioTracks(&self) -> Root<Dom<AudioTrackList>>

source§

fn VideoTracks(&self) -> Root<Dom<VideoTrackList>>

source§

fn TextTracks(&self) -> Root<Dom<TextTrackList>>

source§

fn AddTextTrack( &self, kind: TextTrackKind, label: DOMString, language: DOMString ) -> Root<Dom<TextTrack>>

source§

fn GetVolume(&self) -> Result<Finite<f64>, Error>

source§

fn SetVolume(&self, value: Finite<f64>) -> Result<(), Error>

source§

impl HasParent for HTMLMediaElement

source§

fn as_parent(&self) -> &HTMLElement

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

§

type Parent = HTMLElement

source§

impl IDLInterface for HTMLMediaElement

source§

fn derives(class: &'static DOMClass) -> bool

Returns whether the given DOM class derives that interface.
source§

impl MallocSizeOf for HTMLMediaElement

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

impl MutDomObject for HTMLMediaElement

source§

unsafe fn init_reflector(&self, obj: *mut JSObject)

Initializes the Reflector
source§

impl PartialEq<HTMLMediaElement> for HTMLMediaElement

source§

fn eq(&self, other: &HTMLMediaElement) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToJSValConvertible for HTMLMediaElement

source§

unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)

Convert self to a JSVal. JSAPI failure causes a panic.
source§

impl Traceable for HTMLMediaElement

source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.
source§

impl VirtualMethods for HTMLMediaElement

source§

fn super_type(&self) -> Option<&dyn VirtualMethods>

Returns self as the superclass of the implementation for this trait, if any.
source§

fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation<'_>)

source§

fn unbind_from_tree(&self, context: &UnbindContext<'_>)

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
source§

fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool

Returns true if given attribute attr affects style of the given element.
source§

fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue

Returns the right AttrValue variant for the attribute with name name on this element.
source§

fn bind_to_tree(&self, context: &BindContext)

Called when a Node is appended to a tree, where ‘tree_connected’ indicates whether the tree is part of a Document.
source§

fn children_changed(&self, mutation: &ChildrenMutation<'_>)

Called on the parent when its children are changed.
source§

fn handle_event(&self, event: &Event)

Called during event dispatch after the bubbling phase completes.
source§

fn adopting_steps(&self, old_doc: &Document)

source§

fn cloning_steps( &self, copy: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag )

source§

fn pop(&self)

Called on an element when it is popped off the stack of open elements of a parser.
source§

impl DerivedFrom<Element> for HTMLMediaElement

source§

impl DerivedFrom<EventTarget> for HTMLMediaElement

source§

impl DerivedFrom<HTMLElement> for HTMLMediaElement

source§

impl DerivedFrom<HTMLMediaElement> for HTMLAudioElement

source§

impl DerivedFrom<HTMLMediaElement> for HTMLMediaElement

source§

impl DerivedFrom<HTMLMediaElement> for HTMLVideoElement

source§

impl DerivedFrom<Node> for HTMLMediaElement

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> MaybeBoxed<Box<T, Global>> for T

source§

fn maybe_boxed(self) -> Box<T, Global>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Erased for T

source§

impl<T> ErasedDestructor for Twhere T: 'static,

source§

impl<T> MaybeSendSync for T