Crates.io | bevy_web_codecs |
lib.rs | bevy_web_codecs |
version | 0.1.1 |
created_at | 2025-09-25 00:22:27.528465+00 |
updated_at | 2025-09-25 11:40:05.446024+00 |
description | A plugin for Bevy that uses the WebCodecs API for decoding assets on the web |
homepage | |
repository | https://github.com/jf908/bevy_web_codecs |
max_upload_size | |
id | 1853966 |
size | 152,010 |
This crate is a more efficient web replacement of Bevy's default image loaders by making use of the WebCodecs API to decode images and fallsback to the canvas API when its unavailable. This crate parallelizes image decoding and reduces the bundle size compared to bevy_image's default decoders.
This crate is only supported on wasm targets.
[dependencies]
bevy_web_codecs = "0.1"
use bevy::prelude::*;
use bevy_web_codecs::WebCodecsPlugin;
fn main() {
App::new()
.add_plugins((DefaultPlugins, WebCodecsPlugin::default()))
.run();
}
It's recommended that you turn off bevy's default features so you can disable "png" support so that it doesn't clash with this plugin's png loader.
[dependencies]
bevy_web_codecs_gltf = { version = "0.16", features = ["bevy_animation"] }
use bevy::prelude::*;
use bevy_web_codecs::WebCodecsPlugin;
use bevy_web_codecs_gltf::GltfPlugin;
fn main() {
App::new()
.add_plugins((
DefaultPlugins,
WebCodecsPlugin::default(),
GltfPlugin::default(),
))
.add_systems(Startup, setup)
.run();
}
You will have to disable bevy's bevy_gltf
feature and replace any imports:
// Before
use bevy::prelude::*;
use bevy::gltf::GltfExtras;
// After
use bevy::prelude::*;
use bevy_web_codecs_gltf::prelude::*;
use bevy_web_codecs_gltf::gltf::GltfExtras;
WebCodecsPlugin
registers the following image types by default.
Extension | MIME Type |
---|---|
.jpg, jpeg | image/jpeg |
.png | image/png |
.gif | image/gif |
.webp | image/webp |
.bmp | image/bmp |
.avif | image/avif |
Registered file extensions and MIME types can be configured at startup but support will be limited depending on your browser.
bevy | bevy_web_codecs | bevy_web_codecs_gltf |
---|---|---|
0.16 | 0.1 | 0.16.1 |
bevy_web_codecs
is dual-licensed under either
at your option.