From 749b66417d59a41080cb1d9a97fd6ecef3cf2dec Mon Sep 17 00:00:00 2001 From: psykose Date: Fri, 18 Oct 2024 10:57:16 +0200 Subject: [PATCH] fix play/pause --- src/playbin.vala | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/playbin.vala b/src/playbin.vala index 70a11cd..9fc9407 100644 --- a/src/playbin.vala +++ b/src/playbin.vala @@ -158,13 +158,22 @@ class Playbin : GLib.Object { public void pause () { assert (this.state != PlaybinState.STOPPED); this.state = PlaybinState.PAUSED; - assert (this.mpv.command ({"pause"}) >= 0); + GLib.debug ("setting state to paused"); + // TODO: abstract away this handling around mpv api a bit for auto debug printing + var ret = this.mpv.set_property_flag("pause", true); + if (ret != 0) { + GLib.debug ("failed to set state to paused (%d): %s\n", ret, ret.to_string()); + } } public void play () { assert (this.state != PlaybinState.STOPPED); this.state = PlaybinState.PLAYING; - assert (this.mpv.command ({"play"}) >= 0); + GLib.debug ("setting state to playing"); + var ret = this.mpv.set_property_flag("pause", false); + if (ret != 0) { + GLib.debug ("failed to set state to playing (%d): %s\n", ret, ret.to_string()); + } } public void next_track () {