Skip to content

Unnecessary Seek for decoders - prevents internet radio #333

@pimdh

Description

@pimdh

Hi,
Thanks for making this convenient library. I'm rather new to rust, so apologies if this question is inappropriate or irrelevant.

The Decoders currently require the data argument to implement the seek trait. However, the seek function appears to be only used for the LoopedDecoder, and by the is_wav() and is_flac() check functions. The underlying decoding libraries (except for the Vorbis decoder) do not require seek.

I'm trying to work with internet radio that is a streamed MP3, for which it's hard/undesirable to implement a Seek trait. If I simply strip the seek trait from the Mp3Decoder, the following code works:

let url = "https://example.com/example.mp3";
let mut body = reqwest::blocking::get(url).unwrap();
let source = Mp3Decoder::new(body).unwrap();
let _res = stream_handle.play_raw(source.convert_samples());

Maybe the decoding check functions, the types and the trait bounds could be modified, so that the Mp3Decoder does not always require Seek on the data argument?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions