Struct VideoBuilder

Source
pub struct VideoBuilder(/* private fields */);

Implementations§

Source§

impl VideoBuilder

Source

pub fn id(self, value: impl AttributeValue<String>) -> Self

Source

pub fn class(self, value: impl AttributeValue<String>) -> Self

Source

pub fn autoplay(self, value: impl AttributeValue<bool>) -> Self

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 <video> tag at all. To remove autoplay, the attribute needs to be removed altogether.

Source

pub fn buffered(self, value: impl AttributeValue<String>) -> Self

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

Source

pub fn controls(self, value: impl AttributeValue<bool>) -> Self

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.

Source

pub fn crossorigin(self, value: impl AttributeValue<String>) -> Self

This enumerated attribute indicates whether to use CORS to fetch the related image. CORS-enabled resources can be reused in the <canvas> 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 <canvas> elements. If invalid, it is handled as if the enumerated keyword anonymous was used.

Source

pub fn current_time(self, value: impl AttributeValue<String>) -> Self

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.

Source

pub fn height(self, value: impl AttributeValue<String>) -> Self

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

Source

pub fn loop_(self, value: impl AttributeValue<bool>) -> Self

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

Source

pub fn muted(self, value: impl AttributeValue<bool>) -> Self

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.

Source

pub fn playsinline(self, value: impl AttributeValue<bool>) -> Self

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.

Source

pub fn poster(self, value: impl AttributeValue<String>) -> Self

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.

Source

pub fn preload(self, value: impl AttributeValue<String>) -> Self

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.

Source

pub fn src(self, value: impl AttributeValue<String>) -> Self

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

Source

pub fn width(self, value: impl AttributeValue<String>) -> Self

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

Source§

impl VideoBuilder

Source

pub fn on_blur( self, f: impl 'static + FnMut(FocusEvent, HtmlVideoElement), ) -> Self

Source

pub fn on_click( self, f: impl 'static + FnMut(MouseEvent, HtmlVideoElement), ) -> Self

Source

pub fn on_change(self, f: impl 'static + FnMut(Event, HtmlVideoElement)) -> Self

Source

pub fn on_dblclick( self, f: impl 'static + FnMut(MouseEvent, HtmlVideoElement), ) -> Self

Source

pub fn on_focusout( self, f: impl 'static + FnMut(FocusEvent, HtmlVideoElement), ) -> Self

Source

pub fn on_input( self, f: impl 'static + FnMut(InputEvent, HtmlVideoElement), ) -> Self

Source

pub fn on_keydown( self, f: impl 'static + FnMut(KeyboardEvent, HtmlVideoElement), ) -> Self

Source

pub fn on_keyup( self, f: impl 'static + FnMut(KeyboardEvent, HtmlVideoElement), ) -> Self

Source

pub fn effect(self, f: impl Effect<HtmlVideoElement>) -> Self

Source§

impl VideoBuilder

Source

pub fn text(self, child: impl Text) -> Self

Source

pub fn child<Child>(self, c: Child) -> Self
where Child: Into<Element>,

Trait Implementations§

Source§

impl Builder for VideoBuilder

Source§

impl DomElement for VideoBuilder

Source§

impl From<VideoBuilder> for Element

Source§

fn from(builder: VideoBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<VideoBuilder> for ElementBuilder

Source§

fn from(builder: VideoBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.