serenity-rs/songbird

How to play/load audio source from base64

beig opened this issue · 1 comments

beig commented

Hello,

I am pretty new to rust but creating a discord bot seems like a nice project.

I am storing my mp3 as base64 string in jammdb.
Is there a way to load the sound directly from memory?
The only way I found is writing the base64 to a file and then load it

Thanks

If you're on next, then you should be able to play any supported file format from memory (every owned byte slice e.g., &'static [u8], Bytes, or Vec<u8>). Obviously you'd need to parse the Base64 string back into actual bytes.

If you're on current, then you're correct, you either need to write it out to a local file, transform and pipe it to ffmpeg, or decode it locally into raw f32s/i16s.