[Gambas-user] mpris MediaPlayer2 interface

Bruce Steers bsteers4 at gmail.com
Sat Feb 25 04:16:41 CET 2023

On Fri, 24 Feb 2023 at 23:28, Benoit Minisini <
benoit.minisini at gambas-basic.org> wrote:

> Le 24/02/2023 à 23:58, Bruce Steers a écrit :
> >
> >
> > On Sat, 4 Feb 2023 at 15:15, Bruce Steers <bsteers4 at gmail.com
> > <mailto:bsteers4 at gmail.com>> wrote:
> >
> >
> >
> >     On Sat, 4 Feb 2023 at 01:58, Bruce Steers <bsteers4 at gmail.com
> >     <mailto:bsteers4 at gmail.com>> wrote:
> >
> >
> >
> >         On Fri, 3 Feb 2023 at 18:55, Bruce Steers <bsteers4 at gmail.com
> >         <mailto:bsteers4 at gmail.com>> wrote:
> >
> >             Has anyone tried to give their program an mpris.MediaPlayer2
> >             interface?
> >
> >
> > Right now i have something to talk about with mpris.
> >
> > See the post/download the archive here...
> > https://forum.gambas.one/viewtopic.php?t=1473
> > <https://forum.gambas.one/viewtopic.php?t=1473>
> >
> > archive contains...
> >
> > MPRIS_Server.class  , gives your application it's own mpris interface,
> > should be easy to change existing MediaView or MediaPayer applications
> > to use this class.
> >
> > MprisView , a modified copy of MediaView object supporting MPRIS_Server
> > MediaPlayer (archived) , a MediaPlayer.class supporting MPRIS_Server.
> >
> > MPRIS_Interface.class , view and control other mpris players.
> >
> > Added an MPRIS_Metadata.class to handle many metadata tags.
> >
> > Source contains a rubbish test app demonstrating usage of both classes
> > a basic (probably buggy) media player supporting mpris (MprisView)
> > a "Remote control" button that pops open a controller for other players.
> >
> > If you think you can do a better job .... please do, then post me your
> > code :)
> >
> > If you think I can do a better job .... please tell me how :)
> >
> > All the best
> > BruceS
> >
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> I will look at this. Have you succeed in finding a workaround of current
> 'gb.dbus' bugs?
> Anyway, I don't want any MediaView control to support MPRIS. This should
> be optional.

yes i used the DBus.Properties.Get() method to read any property rather
than trying to access them directly

I put in the project what i called an "MprisView" control , basically a
copy of the MediaView with some tweaks.
tweaks are needed as the MediaView has it's internal controls that need to
fire dbus messages when user adjusts things.

also archived in the project dir is an edited MediaPlayer.class with
similar small changes to send dbus signals.

The problems i came across that meant i needed to change the media classes
* As mentioned above the internal controls/play state changes must fire
dbus signals.
* Duration needs to be known for the metadata so MediaPlayer must Play/Stop
on url load to fill duration property before setting the metadata,

PS. I did not really create the project thinking of seamless inclusion into
It was initially the idea (hence the gb.media.mpris naming) but it kinda
diverged into me realizing i do not know how things should be properly set
up to a gambas inclusion standard so just make it how i know.
it's not even set up properly as a component (i tried correct class
naming), just the mpris classes and tweaked MediaView/MediaPlayer controls
to import to your own programs.

How this should be properly constructed (class names n stuff) to be a
component i do not even know.
Happy to give it a try if you think i could handle it.
My guess would be that i have not grasped a few concepts properly and the
code needs some work.

I'll look into making it a standalone thing. it should be possible to just
have the server act like a player and the programmer can respond to it's
events with any media object.
MediaView will need a couple of enhancements though. it must fire events
for it's internal controls, volume, position playstate.
Some of the MediaPlayer events could probably work.
Position (not constant, only on user change)
Volume (needed event)

i'm sure it could be a good component for gambas.
The initial draft of the first version mpris handler i put on gambas.one
forum (that i was looking for help with) that still needed a lot of work
got 69 downloads and 1600+ views.

the post about the mpris reader/controller has 2500 views.
seems to be a very popular subject as that's less than one month.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230225/18a84507/attachment.htm>

More information about the User mailing list