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§
- Video
Frame - A frame of video.
- Video
Player - A component for playing a video.
- Video
Plugin - Adds support for video playback to a Bevy Application
- Video
Sink - Bevy inserts this component onto your entities when it begins playing a video source.
Use
VideoPlayerto trigger that to happen. - Video
Source - A source of video data.
- Video
Target Assets - Stores target
AssetIds of assets that have a dependency on the videoImageasset.
Enums§
- Playback
Mode - The way Bevy manages the video playback.
Traits§
- AddVideo
Source - A trait that allows adding a custom video source to the object.
This is implemented for
Appto allow registering customDecodabletypes. - Decodable
- A type implementing this trait can be converted to a
Self::Decodertype. - Decoder
- A type implementing this trait can decode frames of video.
- Video
Target App - Adds video-related methods to
App.