johanhelsing / bevy_web_asset Goto Github PK
View Code? Open in Web Editor NEWBevy asset loader that transparently supports loading over http(s)
License: Apache License 2.0
Bevy asset loader that transparently supports loading over http(s)
License: Apache License 2.0
Currently, if the response is a http error, we just blindly pass the payload on to the asset loader, which will most likely fail.
On certain http error codes it probably makes sense to retry, on others it probably makes sense to log a warning/error and return and AssetIoError
.
It's happening because the filesystem watcher implementation in bevy tries to downcast the asset io to FileAssetIO. Since we're wrapping it, that downcast fails, and nothing happens.
Bevy issue: bevyengine/bevy#1414
Bevy 0.12 adds native support for remote asset sources, making most code here redundant.
Will bevy_web_asset
become a legacy crate, or will it provide boilerplate implementations for http/https?
app.register_asset_source("http", ..);
app.register_asset_source("https", ..);
bevy_web_asset main↑1 cargo run --example web_image
Blocking waiting for file lock on build directory
Compiling proc-macro2 v1.0.78
Compiling thiserror v1.0.57
Compiling num-traits v0.2.18
Compiling aho-corasick v1.1.2
Compiling windows v0.52.0
Compiling crc32fast v1.4.0
Compiling khronos-egl v6.0.0
Compiling miniz_oxide v0.7.2
Compiling profiling v1.0.15
Compiling ring v0.16.20
Compiling fdeflate v0.3.4
Compiling blake3 v1.5.0
Compiling polling v2.8.0
Compiling rustix v0.37.27
Compiling anyhow v1.0.80
Compiling accesskit_consumer v0.16.1
error[E0554]: `#![feature]` may not be used on the stable release channel
--> C:\Users\Johan\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustix-0.37.27\src\lib.rs:101:26
|
101 | #![cfg_attr(rustc_attrs, feature(rustc_attrs))]
| ^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0554`.
error: could not compile `rustix` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Hi, do you mind adding a permissive license like MIT / Apache?
I've got a weird double image fetching error going on locally. Building for wasm and testing in firefox on M1.
Hey, here's the screenshot of what I'm seeing.
Essentially it looks like there's a second request getting kicked off that will always take any url and append .meta
on the end.
someurl.jpg
-> someurl.jpg.meta
I am getting this error when trying to load more than one web asset.
ERROR bevy_asset::server: Encountered an I/O error while loading asset: unexpected status code 500 while loading https://example.png: Head byte length should be less than 8kb
This error is misleading and the head byte length is less than 8kb. There is an issue on the surf repo http-rs/surf#289 which points to it being a bug in http-rs/async-h1's DDOS protection but from a cursory glance, I can't see the cause. I could create an issue downstream but its looking unmaintained.
It was reproducing 100% of the time in my project and I think I boiled it down to it happening when:
Since asset meta checks 404s on every asset, this bug happens every time I load more than one asset. I noticed that this bug does not happen on all web servers and I am assuming this is something to do with the size of the 404 response. For testing purposes, I noticed images from Apple's website also return 404s with html bodies when .meta is appended to the end of an image URL and can be used to reproduce this bug.
.insert_resource(AssetMetaCheck::Never)
to avoid 404s. I cannot use this one because I am using processed mode for local assets.surf = { features = [ "curl-client" ] }
When the user has a poor connection and the server can't be reached, we just warn and report the asset as AssetIoError::NotFound
.
However, it probably makes sense to retry if we couldn't reach the server.
We should probably add a loop inside WebAssetIo::load_path
to retry in those cases.
Split from: #4
The unwrap here is causing a panic occasionally:
bevy_web_asset/src/web_asset_io.rs
Line 26 in d4cd4f4
panicked at 'called `Result::unwrap()` on an `Err` value: JsValue(TypeError: NetworkError when attempting to fetch resource.
)', /home/gilescope/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_web_asset-0.4.0/src/web_asset_io.rs:26:83
Got: panicked at 'IoTaskPool resource not found'.
Anyone seen this error before? I'm on bevy 0.7 at the moment (waiting a bit longer to upgrade to 0.8).
Is there some additional setup to do for wasm given things are a tad different on the browser?
isahc is not easily usable on android, because it always uses openssl and doesn't have a published version that can opt-out of that (sagebind/isahc#199).
I read #18 (comment), but it's not clear to me why isahc was preferred over surf, when both appear to not have the issue with loading some urls.
I can do the work and switch back to surf (and set it up so it works with rustls) if that is ok with y'all
When trying to load an Image in a WASM game following error is output to the console
WARN C:\Users\Jay\.cargo\registry\src\github.com-1ecc6299db9ec823\bevy_asset-0.9.1\src\asset_server.rs:454 encountered an error while loading an asset: Error reading image file https://i.pinimg.com/originals/b5/41/b3/b541b339d5fee0af74e95d3fe7bbf038.png: failed to load an image: Format error decoding Png: Unexpected end of data before image end., this is an error in `bevy_render`.
I've been working with this library using an image pulled from S3 as a testing URL.
This image parses in just fine, but I'm running into an asset path parsing error when sending in a url that contains a port.
Ideally, I'd like to use pre-signed urls from S3 and that would look something like this.
The error I'm seeing so far looks like this.
/bevy_asset-0.12.1/src/path.rs:104:37: called `Result::unwrap()` on an `Err` value: InvalidSourceSyntax
I tracked down where I think this is being thrown to the while loop that parses paths looking for :
. Since there is a second :
in the url containing a path, it seems to throw that InvalidSourceSyntax
error.
while let Some((index, char)) = chars.next() {
match char {
':' => {
let (_, char) = chars
.next()
.ok_or(ParseAssetPathError::InvalidSourceSyntax)?;
if char != '/' {
return Err(ParseAssetPathError::InvalidSourceSyntax);
}
let (index, char) = chars
.next()
.ok_or(ParseAssetPathError::InvalidSourceSyntax)?;
if char != '/' {
return Err(ParseAssetPathError::InvalidSourceSyntax);
}
source_range = Some(0..index - 2);
path_range.start = index + 1;
}
'#' => {
path_range.end = index;
label_range = Some(index + 1..asset_path.len());
break;
}
_ => {}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.