Reputation: 6421
I'm trying to create a general remote control application for MPRIS based media players. Controlling the media players is so easy, but as I'm quite new to D-Bus and DBus-GLib, getting values from D-Bus is a bit screwed up for me.
From the documentations I see that I need to get the PlaybackStatus property if I want to know if my player is actually playing something, but I cannot find a working example for getting this value in C.
Currently the line to get it looks like this:
dbus_g_proxy_call(player_proxy, "Get", &err, G_TYPE_STRING, "Volume", G_TYPE_INVALID, G_TYPE_INT, &volume, G_TYPE_INVALID);
Certainly, it does not work, as the org.mpris.MediaPlayer2.Player
interface doesn't understand the Get method.
Upvotes: 3
Views: 3031
Reputation: 5713
Certainly, it does not work, as the
org.mpris.MediaPlayer2.Player
interface doesn't understand theGet
method.
This is the clue you need. The Get
method is actually on the org.freedesktop.DBus.Properties
interface, so you need to call it on a proxy object for that interface, rather than the player_proxy
object (which is presumably a proxy for the org.mpris.MediaPlayer2.Player
interface).
Upvotes: 2
Reputation: 55334
After looking through this source code, it seems you need to use "IsPlaying"
, as seen in the method hx_dbus_player_is_playing
.
Upvotes: 0