Audio Streaming Server with Axum #2658
-
SummaryHi, I must develop audio streaming service. I use Dioxus for frontend and Axum as a backend. I can play streams with html audio in Dioxus but I don't know how to create my own audio stream with URL. I'm lack of knowledge to find out what to do and how to do. I just know that I have to do and I should be able to do with these awesome Dioxus and Axum. How can I create audio stream with URL that html audio component can consume and play without problem. axum version0.7.4 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
Take a look at this PR: https://github.com/tokio-rs/axum/pull/3047/files#diff-85ae2acd48337869f0504aa4eced18f7129187436fedaeee5e5c941c41d6292d. Specifically at the |
Beta Was this translation helpful? Give feedback.
You can useEdit: not relevant to the questionServeFile
. See: #608 (comment)Take a look at this PR: https://github.com/tokio-rs/axum/pull/3047/files#diff-85ae2acd48337869f0504aa4eced18f7129187436fedaeee5e5c941c41d6292d. Specifically at the
try_stream
function.Also, take a look at how
ServeDir
implements sending a portion of a file https://docs.rs/tower-http/latest/src/tower_http/services/fs/serve_dir/future.rs.html#253. It seems like you want to manually send what part of the file you want. I recommend using an AtomicUsize to keep track of which part of the file you should send to everyone.