fix play/pause

This commit is contained in:
psykose 2024-10-18 10:57:16 +02:00
parent 0f5c77bc3d
commit 749b66417d

View file

@ -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 () {