From f023be48f7ac1a10f7ca225973227ef26d31f445 Mon Sep 17 00:00:00 2001 From: naglis <55976-naglis@users.noreply.gitlab.com> Date: Mon, 31 Jul 2023 00:46:49 +0300 Subject: [PATCH] Use `cycle` command for toggling play/pause This way we do not need to get the `pause` property first. --- src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 31e5017..be2b803 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -704,9 +704,6 @@ impl Mpv { } pub fn toggle(&self) -> Result<(), Error> { - match get_mpv_property::(self, "pause") { - Ok(paused) => set_mpv_property(self, "pause", !paused), - Err(msg) => Err(msg), - } + run_mpv_command(self, "cycle", &["pause"]) } }