Browse and listen to thousands of radio stations across the globe right from your terminal ๐ŸŒŽ ๐Ÿ“ป ๐ŸŽตโœจ
radio rust tokio web-radio command-line-tool tui

os_media_controls: OsMediaControls: send_to_os(): set_volume() only on MPRIS

+20 -1
+20 -1
src/os_media_controls.rs
··· 50 Command::Pause => self 51 .controls 52 .set_playback(souvlaki::MediaPlayback::Paused { progress: None }), 53 - Command::SetVolume(volume) => self.controls.set_volume(volume), 54 Command::SetMetadata(metadata) => self.controls.set_metadata(metadata), 55 } 56 }
··· 50 Command::Pause => self 51 .controls 52 .set_playback(souvlaki::MediaPlayback::Paused { progress: None }), 53 + Command::SetVolume(volume) => { 54 + // NOTE: is supported only for MPRIS backend, 55 + // `souvlaki` doesn't provide a way to know this, so 56 + // need to use `cfg` attribute like the way it exposes 57 + // the platform 58 + #[cfg(all( 59 + unix, 60 + not(any(target_os = "macos", target_os = "ios", target_os = "android")) 61 + ))] 62 + { 63 + self.controls.set_volume(volume) 64 + } 65 + #[cfg(not(all( 66 + unix, 67 + not(any(target_os = "macos", target_os = "ios", target_os = "android")) 68 + )))] 69 + { 70 + Ok(()) 71 + } 72 + } 73 Command::SetMetadata(metadata) => self.controls.set_metadata(metadata), 74 } 75 }