From 16fcae51e545acea708aa38416b72f1f52250c3a Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Sun, 27 Oct 2024 12:02:54 -0700 Subject: [PATCH] Implement play_pause --- src/mpris_event_handler.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mpris_event_handler.rs b/src/mpris_event_handler.rs index 29548ae9c..d08804ec2 100644 --- a/src/mpris_event_handler.rs +++ b/src/mpris_event_handler.rs @@ -372,8 +372,17 @@ impl MprisPlayerService { // If `self.can_pause` is `false`, attempting to call this method should have no effect and // raise an error. async fn play_pause(&self) { - // ignore for now - // TODO: implement + match self.playback_status { + PlaybackStatus::Playing => { + self.pause().await; + } + PlaybackStatus::Paused => { + self.play().await; + }, + PlaybackStatus::Stopped => { + warn!("Cannot play, playback is stopped"); + } + } } // Stops playback.