#[repr(C)]pub(crate) struct HTMLMediaElement {Show 38 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>]>, ErrorResult)>>,
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>,
load_state: Cell<LoadState>,
source_children_pointer: DomRefCell<Option<SourceChildrenPointer>>,
current_source_child: MutNullableDom<HTMLSourceElement>,
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: RefCell<Option<HTMLMediaElementFetchContext>>,
media_controls_id: DomRefCell<Option<String>>,
droppable: DroppableHtmlMediaElement,
}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>]>, ErrorResult)>>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>§load_state: Cell<LoadState>Loading state from source, if any.
source_children_pointer: DomRefCell<Option<SourceChildrenPointer>>§current_source_child: MutNullableDom<HTMLSourceElement>§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: RefCell<Option<HTMLMediaElementFetchContext>>Latest fetch request context.
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.
droppable: DroppableHtmlMediaElementImplementations§
Source§impl HTMLMediaElement
impl HTMLMediaElement
pub(crate) fn new_inherited( tag_name: LocalName, prefix: Option<Prefix>, document: &Document, ) -> Self
pub(crate) fn network_state(&self) -> NetworkState
pub(crate) fn get_ready_state(&self) -> ReadyState
fn media_type_id(&self) -> HTMLMediaElementTypeId
fn play_media(&self)
Sourcepub(crate) fn delay_load_event(&self, delay: bool, can_gc: CanGc)
pub(crate) fn delay_load_event(&self, delay: bool, can_gc: CanGc)
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
Sourcefn change_ready_state(&self, ready_state: ReadyState)
fn change_ready_state(&self, ready_state: ReadyState)
Sourcefn invoke_resource_selection_algorithm(&self, can_gc: CanGc)
fn invoke_resource_selection_algorithm(&self, can_gc: CanGc)
Sourcefn resource_selection_algorithm_sync(&self, base_url: ServoUrl, can_gc: CanGc)
fn resource_selection_algorithm_sync(&self, base_url: ServoUrl, can_gc: CanGc)
Sourcefn load_from_src_object(&self)
fn load_from_src_object(&self)
Sourcefn load_from_src_attribute(&self, base_url: ServoUrl, src: &str)
fn load_from_src_attribute(&self, base_url: ServoUrl, src: &str)
Sourcefn load_from_source_child(&self, source: &HTMLSourceElement)
fn load_from_source_child(&self, source: &HTMLSourceElement)
Sourcefn load_from_source_child_failure_steps(&self, source: &HTMLSourceElement)
fn load_from_source_child_failure_steps(&self, source: &HTMLSourceElement)
Sourcefn select_next_source_child(&self, can_gc: CanGc)
fn select_next_source_child(&self, can_gc: CanGc)
fn fetch_request(&self, offset: Option<u64>, seek_lock: Option<SeekLock>)
Sourcefn eligible_for_autoplay(&self) -> bool
fn eligible_for_autoplay(&self) -> bool
Sourcefn resource_fetch_algorithm(&self, resource: Resource)
fn resource_fetch_algorithm(&self, resource: Resource)
Sourcefn queue_dedicated_media_source_failure_steps(&self)
fn queue_dedicated_media_source_failure_steps(&self)
Queues a task to run the dedicated media source failure steps.
fn in_error_state(&self) -> bool
Sourcefn is_potentially_playing(&self) -> bool
fn is_potentially_playing(&self) -> bool
Sourcefn is_blocked_media_element(&self) -> bool
fn is_blocked_media_element(&self) -> bool
Sourcefn is_paused_for_user_interaction(&self) -> bool
fn is_paused_for_user_interaction(&self) -> bool
Sourcefn is_paused_for_in_band_content(&self) -> bool
fn is_paused_for_in_band_content(&self) -> bool
Sourcefn media_element_load_algorithm(&self, can_gc: CanGc)
fn media_element_load_algorithm(&self, can_gc: CanGc)
Sourcefn queue_media_element_task_to_fire_event(&self, name: Atom)
fn queue_media_element_task_to_fire_event(&self, name: Atom)
Queue a media element task given the media element to fire an event at the media element. https://html.spec.whatwg.org/multipage/#queue-a-media-element-task
Sourcefn push_pending_play_promise(&self, promise: &Rc<Promise>)
fn push_pending_play_promise(&self, promise: &Rc<Promise>)
Appends a promise to the list of pending play promises.
Sourcefn take_pending_play_promises(&self, result: ErrorResult)
fn take_pending_play_promises(&self, result: ErrorResult)
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.
Sourcefn fulfill_in_flight_play_promises<F>(&self, f: F)where
F: FnOnce(),
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
#[cfg_attr(crown, allow(crown::unrooted_must_root))] on even more functions, potentially
hiding actual safety bugs.
pub(crate) fn handle_source_child_insertion( &self, source: &HTMLSourceElement, can_gc: CanGc, )
Sourcefn select_next_source_child_after_wait(&self, can_gc: CanGc)
fn select_next_source_child_after_wait(&self, can_gc: CanGc)
Sourcefn media_data_processing_failure_steps(&self)
fn media_data_processing_failure_steps(&self)
https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list => “If the media data cannot be fetched at all, due to network errors…” => “If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all”
Sourcefn media_data_processing_fatal_steps(&self, error: u16, can_gc: CanGc)
fn media_data_processing_fatal_steps(&self, error: u16, can_gc: CanGc)
https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list => “If the connection is interrupted after some media data has been received…” => “If the media data is corrupted”
fn set_player_id(&self, player_id: u64)
Sourcepub(crate) fn set_poster_frame(&self, image: Option<Arc<RasterImage>>)
pub(crate) fn set_poster_frame(&self, image: Option<Arc<RasterImage>>)
fn setup_media_player(&self, resource: &Resource) -> Result<(), ()>
pub(crate) fn set_audio_track(&self, idx: usize, enabled: bool)
pub(crate) fn set_video_track(&self, idx: usize, enabled: bool)
fn end_of_playback_in_forwards_direction(&self, can_gc: CanGc)
fn playback_end(&self, can_gc: CanGc)
fn playback_error(&self, error: &str, can_gc: CanGc)
fn playback_metadata_updated(&self, metadata: &Metadata, can_gc: CanGc)
fn playback_video_frame_updated(&self)
fn playback_need_data(&self, can_gc: CanGc)
fn playback_enough_data(&self)
fn playback_position_changed(&self, position: u64)
fn playback_seek_done(&self)
fn playback_state_changed(&self, state: &PlaybackState)
fn handle_player_event( &self, player_id: usize, event: &PlayerEvent, can_gc: CanGc, )
Sourcefn earliest_possible_position(&self) -> f64
fn earliest_possible_position(&self) -> f64
fn render_controls(&self, can_gc: CanGc)
fn remove_controls(&self)
Sourcepub(crate) fn get_current_frame(&self) -> Option<VideoFrame>
pub(crate) fn get_current_frame(&self) -> Option<VideoFrame>
Gets the video frame at the current playback position.
Sourcepub(crate) fn get_current_frame_to_present(&self) -> Option<MediaFrame>
pub(crate) fn get_current_frame_to_present(&self) -> Option<MediaFrame>
Gets the current frame of the video element to present, if any. https://html.spec.whatwg.org/multipage/#the-video-element:the-video-element-7
pub(crate) fn clear_current_frame_data(&self)
fn handle_resize(&self, width: Option<u32>, height: Option<u32>)
Sourcepub(crate) fn set_audio_renderer(
&self,
audio_renderer: Arc<Mutex<dyn AudioRenderer>>,
can_gc: CanGc,
)
pub(crate) fn set_audio_renderer( &self, audio_renderer: Arc<Mutex<dyn AudioRenderer>>, can_gc: CanGc, )
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.
fn send_media_session_event(&self, event: MediaSessionEvent)
pub(crate) fn set_duration(&self, duration: f64)
pub(crate) fn reset(&self)
Sourcepub(crate) fn origin_is_clean(&self) -> bool
pub(crate) fn origin_is_clean(&self) -> bool
Trait Implementations§
§impl Castable for HTMLMediaElement
impl Castable for HTMLMediaElement
Source§impl DomObject for HTMLMediaElement
impl DomObject for HTMLMediaElement
Source§impl HTMLMediaElementMethods<DomTypeHolder> for HTMLMediaElement
impl HTMLMediaElementMethods<DomTypeHolder> for HTMLMediaElement
Source§fn GetCrossOrigin(&self) -> Option<DOMString>
fn GetCrossOrigin(&self) -> Option<DOMString>
Source§fn GetSrcObject(&self) -> Option<MediaStreamOrBlob<DomTypeHolder>>
fn GetSrcObject(&self) -> Option<MediaStreamOrBlob<DomTypeHolder>>
Source§fn SetSrcObject(
&self,
value: Option<MediaStreamOrBlob<DomTypeHolder>>,
can_gc: CanGc,
)
fn SetSrcObject( &self, value: Option<MediaStreamOrBlob<DomTypeHolder>>, can_gc: CanGc, )
Source§fn CurrentSrc(&self) -> USVString
fn CurrentSrc(&self) -> USVString
Source§fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult
fn CanPlayType(&self, type_: DOMString) -> CanPlayTypeResult
Source§fn SetDefaultPlaybackRate(&self, value: Finite<f64>) -> ErrorResult
fn SetDefaultPlaybackRate(&self, value: Finite<f64>) -> ErrorResult
Source§fn SetPlaybackRate(&self, value: Finite<f64>) -> ErrorResult
fn SetPlaybackRate(&self, value: Finite<f64>) -> ErrorResult
Source§fn CurrentTime(&self) -> Finite<f64>
fn CurrentTime(&self) -> Finite<f64>
Source§fn AudioTracks(&self, can_gc: CanGc) -> DomRoot<AudioTrackList>
fn AudioTracks(&self, can_gc: CanGc) -> DomRoot<AudioTrackList>
Source§fn VideoTracks(&self, can_gc: CanGc) -> DomRoot<VideoTrackList>
fn VideoTracks(&self, can_gc: CanGc) -> DomRoot<VideoTrackList>
Source§fn TextTracks(&self, can_gc: CanGc) -> DomRoot<TextTrackList>
fn TextTracks(&self, can_gc: CanGc) -> DomRoot<TextTrackList>
Source§fn AddTextTrack(
&self,
kind: TextTrackKind,
label: DOMString,
language: DOMString,
can_gc: CanGc,
) -> DomRoot<TextTrack>
fn AddTextTrack( &self, kind: TextTrackKind, label: DOMString, language: DOMString, can_gc: CanGc, ) -> DomRoot<TextTrack>
fn Autoplay(&self) -> bool
fn SetAutoplay(&self, value: bool)
fn Loop(&self) -> bool
fn SetLoop(&self, value: bool)
fn DefaultMuted(&self) -> bool
fn SetDefaultMuted(&self, value: bool)
fn Controls(&self) -> bool
fn SetControls(&self, value: bool)
fn Src(&self) -> USVString
fn SetSrc(&self, value: USVString)
fn Preload(&self) -> DOMString
fn SetPreload(&self, value: DOMString)
Source§impl HasParent for HTMLMediaElement
impl HasParent for HTMLMediaElement
Source§fn as_parent(&self) -> &HTMLElement
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
impl IDLInterface for HTMLMediaElement
Source§impl MallocSizeOf for HTMLMediaElement
impl MallocSizeOf for HTMLMediaElement
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for HTMLMediaElement
impl MutDomObject for HTMLMediaElement
Source§impl PartialEq for HTMLMediaElement
impl PartialEq for HTMLMediaElement
Source§impl Traceable for HTMLMediaElement
impl Traceable for HTMLMediaElement
Source§impl VirtualMethods for HTMLMediaElement
impl VirtualMethods for HTMLMediaElement
Source§fn unbind_from_tree(&self, context: &UnbindContext<'_>, can_gc: CanGc)
fn unbind_from_tree(&self, context: &UnbindContext<'_>, can_gc: CanGc)
Source§fn super_type(&self) -> Option<&dyn VirtualMethods>
fn super_type(&self) -> Option<&dyn VirtualMethods>
Source§fn attribute_mutated(
&self,
attr: &Attr,
mutation: AttributeMutation<'_>,
can_gc: CanGc,
)
fn attribute_mutated( &self, attr: &Attr, mutation: AttributeMutation<'_>, can_gc: CanGc, )
Source§fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
fn attribute_affects_presentational_hints(&self, attr: &Attr) -> bool
true if given attribute attr affects style of the
given element.Source§fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
name
on this element.Source§fn post_connection_steps(&self, can_gc: CanGc)
fn post_connection_steps(&self, can_gc: CanGc)
Source§fn bind_to_tree(&self, context: &BindContext<'_>, can_gc: CanGc)
fn bind_to_tree(&self, context: &BindContext<'_>, can_gc: CanGc)
Source§fn children_changed(&self, mutation: &ChildrenMutation<'_>, can_gc: CanGc)
fn children_changed(&self, mutation: &ChildrenMutation<'_>, can_gc: CanGc)
Source§fn handle_event(&self, event: &Event, can_gc: CanGc)
fn handle_event(&self, event: &Event, can_gc: CanGc)
Source§fn adopting_steps(&self, old_doc: &Document, can_gc: CanGc)
fn adopting_steps(&self, old_doc: &Document, can_gc: CanGc)
Source§fn cloning_steps(
&self,
copy: &Node,
maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag,
can_gc: CanGc,
)
fn cloning_steps( &self, copy: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag, can_gc: CanGc, )
impl DerivedFrom<Element> for HTMLMediaElement
impl DerivedFrom<EventTarget> for HTMLMediaElement
impl DerivedFrom<HTMLElement> for HTMLMediaElement
impl DerivedFrom<HTMLMediaElement> for HTMLAudioElement
impl DerivedFrom<HTMLMediaElement> for HTMLMediaElement
impl DerivedFrom<HTMLMediaElement> for HTMLVideoElement
impl DerivedFrom<Node> for HTMLMediaElement
impl Eq for HTMLMediaElement
Auto Trait Implementations§
impl !Freeze for HTMLMediaElement
impl !RefUnwindSafe for HTMLMediaElement
impl !Send for HTMLMediaElement
impl !Sync for HTMLMediaElement
impl Unpin for HTMLMediaElement
impl !UnwindSafe for HTMLMediaElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
GlobalScope] of the realm that the DomObject was created in. If this
object is a Node, this will be different from it’s owning Document if adopted by. For
Nodes it’s almost always better to use NodeTraits::owning_global.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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