From 347cb55c9d4883c7ca8c40758a5b274ae730a01f Mon Sep 17 00:00:00 2001 From: Erica Z Date: Sat, 26 Oct 2024 11:34:12 +0200 Subject: [PATCH] more mpris --- src/mpris.vala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mpris.vala b/src/mpris.vala index 8243845..7d69bd9 100644 --- a/src/mpris.vala +++ b/src/mpris.vala @@ -40,7 +40,7 @@ class MprisPlayer : Object { internal signal void on_stop (); internal signal void on_play (); internal signal void on_seek (int64 offset); - internal signal void on_set_position (string track_id, int64 position); + internal signal void on_set_position (ObjectPath track_id, int64 position); public void next () throws Error { this.on_next (); } public void previous () throws Error { this.on_previous (); } @@ -49,7 +49,7 @@ class MprisPlayer : Object { public void stop () throws Error { this.on_stop (); } public void play () throws Error { this.on_play (); } public void seek (int64 offset) throws Error { this.on_seek (offset); } - public void set_position (string track_id, int64 position) throws Error { this.on_set_position (track_id, position); } + public void set_position (ObjectPath track_id, int64 position) throws Error { this.on_set_position (track_id, position); } public void open_uri (string uri) throws Error { assert (false); } public signal void seeked (int64 position); @@ -152,6 +152,12 @@ class MprisPlayer : Object { if (playbin.state == PlaybinState.PAUSED) playbin.play (); else if (playbin.state == PlaybinState.PLAYING) playbin.pause (); }); + this.on_stop.connect (() => { + playbin.stop (); + }); + + // TODO: seeking from mpris + // TODO: trigger the seeked signal when applicable this.notify.connect ((p) => { var builder = new VariantBuilder (VariantType.ARRAY);