#[non_exhaustive]pub struct Video {
pub id: Option<WidgetId>,
pub source: VideoSource,
pub width: Option<f32>,
pub height: Option<f32>,
pub autoplay: bool,
pub loop_playback: bool,
pub audio: VideoAudioOptions,
}Expand description
A platform-native video player widget.
The video is rendered by the platform’s native player and embedded into the
Fission layout as an opaque surface. Use
[crate::internal::BuildCtx::video_controls] to create play/pause/seek
action envelopes.
§Example
Video::network("https://example.com/clip.mp4")
.size(640.0, 360.0)
.autoplay(true)
.loop_playback(false)
.audio(VideoAudioOptions::playback())
.into();Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: Option<WidgetId>Stable widget identity (auto-derived from source if None).
source: VideoSourceTyped video source consumed by the active shell.
width: Option<f32>Fixed width in layout points.
height: Option<f32>Fixed height in layout points.
autoplay: boolWhether to start playing immediately.
loop_playback: boolWhether to loop playback when the video ends.
audio: VideoAudioOptionsPlatform-neutral audio-session behavior for this video.
The default is VideoAudioOptions::system_default, which lets the
host platform keep its normal audio policy. Use
VideoAudioOptions::playback for foreground media playback that
should behave like a video player rather than incidental UI audio.
Implementations§
Source§impl Video
impl Video
Sourcepub fn from_source(source: impl Into<VideoSource>) -> Self
pub fn from_source(source: impl Into<VideoSource>) -> Self
Creates a video from a typed source.
Sourcepub fn size(self, width: f32, height: f32) -> Self
pub fn size(self, width: f32, height: f32) -> Self
Sets a fixed width and height in layout points.
Sourcepub fn loop_playback(self, loop_playback: bool) -> Self
pub fn loop_playback(self, loop_playback: bool) -> Self
Sets whether playback loops after reaching the end.
Sourcepub fn audio(self, audio: VideoAudioOptions) -> Self
pub fn audio(self, audio: VideoAudioOptions) -> Self
Sets platform-neutral audio behavior.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Video
impl<'de> Deserialize<'de> for Video
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Video
impl RefUnwindSafe for Video
impl Send for Video
impl Sync for Video
impl Unpin for Video
impl UnsafeUnpin for Video
impl UnwindSafe for Video
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.