Skip to main content

use_video

Function use_video 

pub fn use_video<Source>(
    video_source: impl FnOnce() -> Source + 'static,
) -> VideoPlayer
where Source: Into<VideoSource>,
Available on crate feature video only.
Expand description

Create a VideoPlayer and start playing video_source().

ยงExample

use freya::{
    elements::image::image,
    prelude::*,
    video::*,
};

fn app() -> impl IntoElement {
    let player = use_video(|| "video.mp4");

    rect().maybe_child(player.frame().map(image))
}