Use `cycle` command for toggling play/pause

This way we do not need to get the `pause` property first.
This commit is contained in:
naglis 2023-07-31 00:46:49 +03:00
parent c5550739f4
commit f023be48f7
1 changed files with 1 additions and 4 deletions

View File

@ -704,9 +704,6 @@ impl Mpv {
} }
pub fn toggle(&self) -> Result<(), Error> { pub fn toggle(&self) -> Result<(), Error> {
match get_mpv_property::<bool>(self, "pause") { run_mpv_command(self, "cycle", &["pause"])
Ok(paused) => set_mpv_property(self, "pause", !paused),
Err(msg) => Err(msg),
}
} }
} }