rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Question: playing audio from an async stream

Open MikMuellerDev opened this issue 2 years ago • 0 comments

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:

let mut stream = reqwest::get(url).await.unwrap().bytes_stream();

The optimal solution would transform the stream and play it directly.

MikMuellerDev avatar Sep 04 '22 20:09 MikMuellerDev