[][src]Struct moxie_dom::elements::media::VideoBuilder

#[must_use = "needs to be built"]pub struct VideoBuilder { /* fields omitted */ }

The HTML Video element (<video>) embeds a media player which supports video playback into the document.

A type for initializing the element's attributes before calling build.

Implementations

impl VideoBuilder[src]

pub fn build(self) -> Video[src]

Initialize the element with all of the attributes so far.

impl VideoBuilder[src]

pub fn autoplay(self, to_set: bool) -> Self[src]

If specified, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data.

Note: Sites that automatically play audio (or videos with an audio track) can be an unpleasant experience for users, so should be avoided when possible. If you must offer autoplay functionality, you should make it opt-in (requiring a user to specifically enable it). However, this can be useful when creating media elements whose source will be set at a later time, under user control. See our autoplay guide for additional information about how to properly use autoplay.

To disable video autoplay, autoplay="false" will not work; the video will autoplay if the attribute is there in the

pub fn buffered(self, to_set: impl ToString) -> Self[src]

An attribute you can read to determine the time ranges of the buffered media. This attribute contains a TimeRanges object.

pub fn controls(self, to_set: bool) -> Self[src]

If this attribute is present, the browser will offer controls to allow the user to control video playback, including volume, seeking, and pause/resume playback.

pub fn crossorigin(self, to_set: impl ToString) -> Self[src]

This enumerated attribute indicates whether to use CORS to fetch the related image. CORS-enabled resources can be reused in the element without being tainted. The allowed values are:

  • anonymous: Sends a cross-origin request without a credential. In other words, it sends the Origin: HTTP header without a cookie, X.509 certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (by not setting the Access-Control-Allow-Origin: HTTP header), the image will be tainted, and its usage restricted.
  • use-credentials: Sends a cross-origin request with a credential. In other words, it sends the Origin: HTTP header with a cookie, a certificate, or performing HTTP Basic authentication. If the server does not give credentials to the origin site (through Access-Control-Allow-Credentials: HTTP header), the image will be tainted and its usage restricted.

When not present, the resource is fetched without a CORS request (i.e. without sending the Origin: HTTP header), preventing its non-tainted used in elements. If invalid, it is handled as if the enumerated keyword anonymous was used.

pub fn current_time(self, to_set: impl ToString) -> Self[src]

Reading currentTime returns a double-precision floating-point value indicating the current playback position of the media specified in seconds. If the media has not started playing yet, the time offset at which it will begin is returned. Setting currentTime sets the current playback position to the given time and seeks the media to that position if the media is currently loaded.

If the media is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. Other media may have a media timeline that doesn't start at 0 seconds, so setting currentTime to a time before that would fail. The getStartDate() method can be used to determine the beginning point of the media timeline's reference frame.

pub fn height(self, to_set: impl ToString) -> Self[src]

The height of the video's display area, in CSS pixels (absolute values only; no percentages.)

pub fn loop_(self, to_set: bool) -> Self[src]

If specified, the browser will automatically seek back to the start upon reaching the end of the video.

pub fn muted(self, to_set: bool) -> Self[src]

Indicates the default setting of the audio contained in the video. If set, the audio will be initially silenced. Its default value is false, meaning that the audio will be played when the video is played.

pub fn playsinline(self, to_set: bool) -> Self[src]

Indicating that the video is to be played "inline", that is within the element's playback area. Note that the absence of this attribute does not imply that the video will always be played in fullscreen.

pub fn poster(self, to_set: impl ToString) -> Self[src]

A URL for an image to be shown while the video is downloading. If this attribute isn't specified, nothing is displayed until the first frame is available, then the first frame is shown as the poster frame.

pub fn preload(self, to_set: impl ToString) -> Self[src]

This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience with regards to what content is loaded before the video is played. It may have one of the following values:

  • none: Indicates that the video should not be preloaded.
  • metadata: Indicates that only video metadata (e.g. length) is fetched.
  • auto: Indicates that the whole video file can be downloaded, even if the user is not expected to use it.
  • empty string: Synonym of the auto value.

The default value is different for each browser. The spec advises it to be set to metadata.

Note:

The autoplay attribute has precedence over preload. If autoplay is specified, the browser would obviously need to start downloading the video for playback.

The specification does not force the browser to follow the value of this attribute; it is a mere hint.

pub fn src(self, to_set: impl ToString) -> Self[src]

The URL of the video to embed. This is optional; you may instead use the element within the video block to specify the video to embed.

pub fn width(self, to_set: impl ToString) -> Self[src]

The width of the video's display area, in CSS pixels (absolute values only; no percentages).

Trait Implementations

impl Element for VideoBuilder[src]

impl<E> EventTarget<E> for VideoBuilder where
    E: GlobalEvent
[src]

impl GlobalEventHandler for VideoBuilder[src]

impl HtmlElement for VideoBuilder[src]

impl Node for VideoBuilder[src]

impl Parent<Source> for VideoBuilder[src]

impl Parent<Track> for VideoBuilder[src]

Auto Trait Implementations

impl !RefUnwindSafe for VideoBuilder

impl !Send for VideoBuilder

impl !Sync for VideoBuilder

impl Unpin for VideoBuilder

impl !UnwindSafe for VideoBuilder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<N> Child for N where
    N: Node
[src]

impl<T> Downcast for T where
    T: Any

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.