-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: playing audio from an async stream #439
Comments
I managed to stream network mp3: https://github.com/JasonWei512/code-radio-cli See Basically, you need to:
let response = reqwest::blocking::get(listen_url).unwrap();
let source = Mp3StreamDecoder::new(response).unwrap(); // The Mp3Decoder without `Seek` trait bound in step 1
let sink = rodio::Sink::try_new(&stream_handle).unwrap();
sink.append(source); |
Okay, thank you very much, I will soon give this a try :) |
Despite this issue being closed, i would like to thank you for your answer. |
Hello, I like rodio but am struggeling to play audio from a network stream.
Problem
I have a stream of type
futures_util::StreamExt
which has been fetched using the reqwest crate.The problem is that this stream does not support
Seek
and other traits required by rodio.I tried buffering the stream, then playing it, but it leads to pauses during playing.
This is a live-stream so i cannot download the entire response but must play it in an iterator-like fashion.
I do not know how to convert this stream into a type which implements the required traits used by rodio.
Here is what this stream looks like:
The optimal solution would transform the stream and play it directly.
The text was updated successfully, but these errors were encountered: