Video

Struct Video 

Source
pub struct Video(/* private fields */);
Expand description

A raw video view that displays video without native controls.

Use this component when you want to display video content and build your own custom UI controls. For a full-featured player with native controls, use VideoPlayer instead.

§Platform Implementation

  • iOS/macOS: Uses AVPlayerLayer directly
  • Android: Uses SurfaceView with ExoPlayer

Implementations§

Source§

impl Video

Source

pub fn new(source: impl IntoComputed<Url>) -> Video

Creates a new raw video view.

Source

pub const fn aspect_ratio(self, aspect_ratio: AspectRatio) -> Video

Sets the aspect ratio mode for the video.

Source

pub const fn loops(self, loops: bool) -> Video

Sets whether the video should loop when it ends.

Source

pub fn on_event(self, handler: impl Fn(Event) + 'static) -> Video

Sets the event handler for video events.

Source

pub fn muted(self, muted: &Binding<bool>) -> Video

Mutes or unmutes the video based on the provided boolean binding.

Source

pub fn volume(self, volume: &Binding<f32>) -> Video

Sets the volume binding for the video.

Trait Implementations§

Source§

impl ConfigurableView for Video

Source§

type Config = VideoConfig

The configuration type associated with this view. Read more
Source§

fn config(self) -> <Video as ConfigurableView>::Config

Returns the configuration for this view. Read more
Source§

impl Debug for Video

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<VideoConfig> for Video

Source§

fn from(value: VideoConfig) -> Video

Converts to this type from the input type.
Source§

impl View for Video

Source§

fn body(self, env: &Environment) -> impl View

Build this view and return the content. Read more

Auto Trait Implementations§

§

impl Freeze for Video

§

impl !RefUnwindSafe for Video

§

impl !Send for Video

§

impl !Sync for Video

§

impl Unpin for Video

§

impl !UnwindSafe for Video

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> IdentifiableExt for T

Source§

fn use_id<F, Id>(self, f: F) -> UseId<Self, F>
where F: Fn(&Self) -> Id, Id: Ord + Hash,

Wraps the value in a UseId with the provided identification function.
Source§

fn self_id(self) -> SelfId<Self>

Wraps the value in a SelfId, making the value serve as its own identifier.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

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<V> IntoView for V
where V: View,

Source§

type Output = V

The resulting View type after conversion.
Source§

fn into_view(self, _env: &Environment) -> <V as IntoView>::Output

Converts the implementing type into a View. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<V> ViewExt for V
where V: View,

Source§

fn metadata<T: MetadataKey>(self, metadata: T) -> Metadata<T>

Attaches metadata to a view. Read more
Source§

fn with<T: 'static>(self, value: T) -> With<Self, T>

Associates a value with this view in the environment.
Source§

fn title(self, title: impl Into<Text>) -> NavigationView

Sets this view as the content of a navigation view with the specified title. Read more
Source§

fn focused<T: 'static + Eq + Clone>( self, value: &Binding<Option<T>>, equals: T, ) -> Metadata<Focused>

Marks this view as focused when the binding matches the specified value. Read more
Source§

fn on_change<C, F>(self, source: &C, handler: F) -> OnChange<Self, C::Guard>
where C: Signal, C::Output: PartialEq + Clone, F: Fn(C::Output) + 'static,

Monitors a signal for changes and triggers a handler when the signal’s value changes. Read more
Source§

fn task<Fut>(self, task: Fut) -> Metadata<Retain>
where Fut: Future<Output = ()> + 'static,

Spawns an asynchronous task tied to the lifecycle of this view. Read more
Source§

fn anyview(self) -> AnyView

Converts this view to an AnyView type-erased container.
Source§

fn background(self, background: impl Into<Background>) -> Metadata<Background>

Sets the background of this view. Read more
Source§

fn foreground( self, color: impl IntoComputed<Color>, ) -> Metadata<ForegroundColor>

Sets the foreground color of this view. Read more
Source§

fn overlay<V>(self, overlay: V) -> Overlay<Self, V>

Adds an overlay to this view. Read more
Source§

fn event<H: 'static>( self, event: Event, handler: impl HandlerFnOnce<H, ()> + 'static, ) -> Metadata<OnEvent>

Adds an event handler for the specified event. Read more
Source§

fn on_disappear<H: 'static>( self, handler: impl HandlerFnOnce<H, ()> + 'static, ) -> Metadata<OnEvent>

Adds a handler that triggers when the view disappears. Read more
Source§

fn on_appear<H: 'static>( self, handler: impl HandlerFnOnce<H, ()> + 'static, ) -> Metadata<OnEvent>

Adds a handler that triggers when the view appears. Read more
Source§

fn badge(self, value: impl IntoComputed<i32>) -> Badge

Adds a badge to this view. Read more
Source§

fn width(self, width: f32) -> Frame

Fixes this view’s width to the provided value.
Source§

fn height(self, height: f32) -> Frame

Fixes this view’s height to the provided value.
Source§

fn min_width(self, width: f32) -> Frame

Applies a minimum width constraint.
Source§

fn max_width(self, width: f32) -> Frame

Applies a maximum width constraint.
Source§

fn min_height(self, height: f32) -> Frame

Applies a minimum height constraint.
Source§

fn max_height(self, height: f32) -> Frame

Applies a maximum height constraint.
Source§

fn size(self, width: f32, height: f32) -> Frame

Fixes both width and height simultaneously.
Source§

fn min_size(self, width: f32, height: f32) -> Frame

Applies minimum constraints on both axes.
Source§

fn max_size(self, width: f32, height: f32) -> Frame

Applies maximum constraints on both axes.
Source§

fn alignment(self, alignment: Alignment) -> Frame

Aligns this view within its frame using the provided alignment.
Source§

fn padding_with(self, edge: impl Into<EdgeInsets>) -> Padding

Adds padding to this view with custom edge insets. Read more
Source§

fn padding(self) -> Padding

Adds default padding to this view. Read more
Source§

fn secure(self) -> Metadata<Secure>

Marks this view as secure. Read more
Source§

fn tag<T>(self, tag: T) -> TaggedView<T, Self>

Tags this view with a custom tag for identification. Read more
Source§

fn a11y_label( self, label: impl Into<Str>, ) -> IgnorableMetadata<AccessibilityLabel>

Sets the accessibility label for this view. Read more
Source§

fn a11y_role( self, role: AccessibilityRole, ) -> IgnorableMetadata<AccessibilityRole>

Sets the accessibility role for this view. Read more
Source§

fn gesture<P: 'static>( self, gesture: impl Into<Gesture>, action: impl HandlerFn<P, ()> + 'static, ) -> Metadata<GestureObserver>

Observes a gesture and executes an action when the gesture is recognized. Read more
Source§

fn on_tap<P: 'static>( self, action: impl HandlerFn<P, ()> + 'static, ) -> Metadata<GestureObserver>

Adds a tap gesture recognizer to this view that triggers the specified action. Read more
Source§

fn shadow(self, shadow: impl Into<Shadow>) -> Metadata<Shadow>

Applies a shadow effect to this view.
Source§

fn ignore_safe_area(self, edges: EdgeSet) -> Metadata<IgnoreSafeArea>

Extends this view’s bounds to ignore safe area insets on the specified edges. Read more
Source§

fn install(self, plugin: impl Plugin) -> impl View

Installs a plugin into the environment.
Source§

fn retain<T: 'static>(self, value: T) -> Metadata<Retain>

Retains a value for the lifetime of this view. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more