Crate bevy_av1

Crate bevy_av1 

Source
Expand description

Video support for the game engine Bevy. Supports decoding AV1 video in an IVF container.

Extensible to other formats by implementing Decodable + Asset.

§Usage

Add VideoPlugin to your Bevy App, then load a VideoSource asset and spawn a VideoPlayer component.

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands
        .spawn(VideoPlayer::new(
            asset_server.load("av1/cosmos-laundromat.ivf"),
            PlaybackMode::Remove,
        ))
        .observe(
            |add: On<Add, VideoSink>,
             sinks: Query<&VideoSink>,
             mut commands: Commands| {
                let entity = add.entity;
                if let Ok(sink) = sinks.get(entity) {
                    commands
                        .entity(entity)
                        .insert(Sprite::from_image(sink.image().clone()));
                }
            },
        );
}

Re-exports§

pub use async_channel::Sender;

Structs§

VideoFrame
A frame of video.
VideoPlayer
A component for playing a video.
VideoPlugin
Adds support for video playback to a Bevy Application
VideoSink
Bevy inserts this component onto your entities when it begins playing a video source. Use VideoPlayer to trigger that to happen.
VideoSource
A source of video data.
VideoTargetAssets
Stores target AssetIds of assets that have a dependency on the video Image asset.

Enums§

PlaybackMode
The way Bevy manages the video playback.

Traits§

AddVideoSource
A trait that allows adding a custom video source to the object. This is implemented for App to allow registering custom Decodable types.
Decodable
A type implementing this trait can be converted to a Self::Decoder type.
Decoder
A type implementing this trait can decode frames of video.
VideoTargetApp
Adds video-related methods to App.