Replies: 1 comment 1 reply
-
Hi, I just had the same "problem" and found a solution. It is actually really easy. You need to add [dependencies]
tower = "0.4"
tower-http = { version = "0.4", features = ["fs"] } Your new code would look something like this: use tower::ServiceExt;
async fn handler(request: Request<Body>) -> impl IntoResponse {
let filename = "sample_video.mp4";
let serve_file = tower_http::services::fs::ServeFile::new(filename);
serve_file.oneshot(request).await
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm trying to stream a video from FS through the Axum server to the browser and use browser native video player.
Here is my naive version, but it completely fails.
I know that I should respond with 206 when I get some Ranges.
I already tried it and it doesn't help.
Can someone help me clarify the communication in this process?
I would rather explanation how it works then fixing my code 👍
My sample video: https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_30mb.mp4
Beta Was this translation helpful? Give feedback.
All reactions