pub struct Video<'a> { /* private fields */ }Expand description
A local video file played in place. Its state (the player, the position,
the volume) lives in the context, by id, from one pass to
the next.
Implementations§
Source§impl<'a> Video<'a>
impl<'a> Video<'a>
Sourcepub fn new(source: impl AsRef<Path>) -> Self
pub fn new(source: impl AsRef<Path>) -> Self
The file at source, with full controls, paused on its first picture.
Sourcepub fn id(self, id: impl Into<String>) -> Self
pub fn id(self, id: impl Into<String>) -> Self
Its name for agents (the videos collector, the video.* commands’
video) and its key in the context. Without one, the video is keyed by
its file and the Ui it is drawn in, and agents do not see it.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Its accessible name, instead of “Video: “ and the file’s name.
pub fn controls(self, controls: Controls) -> Self
Sourcepub fn autoplay(self, on: bool) -> Self
pub fn autoplay(self, on: bool) -> Self
Plays as soon as it opens, and again when drawn after being out of view.
Sourcepub fn muted(self, on: bool) -> Self
pub fn muted(self, on: bool) -> Self
Starts without sound (read when it opens; the volume slider, or
video.mute, gives it back).
pub fn fit(self, fit: Fit) -> Self
Sourcepub fn poster(self, poster: impl Into<SizedTexture>) -> Self
pub fn poster(self, poster: impl Into<SizedTexture>) -> Self
A picture shown until it first plays or moves, instead of its first
frame (a texture the application loaded: &TextureHandle converts).
Sourcepub fn size(self, size: Vec2) -> Self
pub fn size(self, size: Vec2) -> Self
Its whole size, controls included. By default, the available width, and the picture as high as its shape asks.
Sourcepub fn backend(self, backend: Option<Arc<dyn VideoBackend>>) -> Self
pub fn backend(self, backend: Option<Arc<dyn VideoBackend>>) -> Self
What plays it (read when it opens), instead of this build’s
(default_backend); None draws the placeholder.
Sourcepub fn app(self, app: &'a AppHandle) -> Self
pub fn app(self, app: &'a AppHandle) -> Self
The application: Open outside goes through its links service.
Sourcepub fn surface(self, surface: &'a str) -> Self
pub fn surface(self, surface: &'a str) -> Self
The focus surface around the picture, for key bindings (SURFACE
by default).
Sourcepub fn take_focus(self, on: bool) -> Self
pub fn take_focus(self, on: bool) -> Self
The picture takes the keyboard focus this pass.
Sourcepub fn show(self, ui: &mut Ui) -> VideoOutput
pub fn show(self, ui: &mut Ui) -> VideoOutput
Draws it.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Video<'a>
impl<'a> !RefUnwindSafe for Video<'a>
impl<'a> !Send for Video<'a>
impl<'a> !Sync for Video<'a>
impl<'a> Unpin for Video<'a>
impl<'a> UnsafeUnpin for Video<'a>
impl<'a> !UnwindSafe for Video<'a>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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