rodio
rodio copied to clipboard
an error occurred on output stream: The requested device is no longer available. For example, it has been unplugged.
Hi, I'm writing a tui and am using rodio for audio playback.
I'm not sure how to handle an error occurred on output stream: The requested device is no longer available. For example, it has been unplugged
. This happens when I unplug my earphones which makes sense. I want to retry the default device but I'm not sure how to detect this error because it comes from eprintln!
.
Also, I'd like there to be no prints in the first place since it screws up my terminal output. I would think errors are routed through the log
crate for library users to handle.
What am I missing on both fronts?
I want to retry the default device but I'm not sure how to detect this error because it comes from eprintln!
In theory the error should be returned to the user, and not be routed to eprintln
. The error originates from cpal actually, and rodio only transmits it. Can you maybe check your code if it contains eprintln?
I have eprintln!
only in areas where operations that return the terminal to normal fail which is divorced from audio playback. I doubt it's any of those since the program runs as if no error happened but all audio operations result in no sound which makes sense. All other logging is routed through the log
crate in my application.
I presumed the error came from this line here: https://docs.rs/rodio/latest/src/rodio/stream.rs.html#198 but I didn't dig any further.
I use rodio in my project here: https://github.com/tochiu/c8/blob/main/src/run/audio.rs
@tochiu I see. Yeah there should be a way to customize the callback....