bevy_video_playing 0.10.0

Decode and render h264 video in Bevy 0.10.0
Documentation
  • Coverage
  • 0%
    0 out of 13 items documented0 out of 6 items with examples
  • Size
  • Source code size: 10.0 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 265.8 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 10s Average build duration of successful builds.
  • all releases: 1m 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • sethblocks/bevy_video
    5 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sethblocks

Bevy Video

Stream or play video in your Bevy app!

Currently supports: Bevy 0.10.0

use bevy::prelude::*;
use bevy_video::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(VideoPlugin)
        .add_startup_system(setup)
        .add_system(push_frame)
        .run();
}

fn setup(
    mut commands: Commands,
    mut images: ResMut<Assets<Image>>,
) {
    let (image_handle, video_decoder) = VideoDecoder::create(&mut images);

    // decoder
    commands.spawn(video_decoder);

    // ...
}

fn push_frame(
    decoders: Query<&VideoDecoder>,
    mut materials: ResMut<Assets<MaterialThatUsesTheImage>>,
) {
    for _ in materials.iter_mut() {
        // otherwise the image on screen wont update
    }

    for decoder in decoders.iter() {
        decoder.add_video_packet(/* Vec<u8> representing an H.264 packet */);

        // Note: packets are decoded asynchronously in another thread
        // The Images will update automatically
    }
}