rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Panic when getting outputstream from headphones when other audio is playing

Open merelymyself opened this issue 3 years ago • 0 comments

Code: OutputStream::try_from_device(&vec_of_acc[0]).unwrap(), wherein &vec_of_acc[0] is of type Device.

It works when no other audio is playing, but when I have cmus or YouTube active, everytime I try to run it it throws the following error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DefaultStreamConfigError(DeviceNotAvailable)', src/music_backend/device_handling.rs:82:55
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1749:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/result.rs:1065:23
   4: rustmus::music_backend::device_handling::set_output_stream
             at ./src/music_backend/device_handling.rs:82:9
   5: rustmus::main
             at ./src/main.rs:20:33
   6: core::ops::function::FnOnce::call_once
             at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

merelymyself avatar Apr 30 '22 13:04 merelymyself