Page 1 of 2

mpris media controller (WIP)

Posted: Sunday 29th January 2023 5:00pm
by BruceSteers
I've been making a new thing that some of you may find interesting or even useful.

it's a DBus mpris.MediaPlayer2 controller.

What i have so far..

The program opens a tray icon on launch.

Right clicking the icon shows the menus.

A menu is created for any found controlable DBus mpris players
(things like vlc, firefox (youtube), SMplayer, Spotify, many other media players)

The related players icon is shown and the menu will contain Rewind/Prev/Pause+Play/Next/Forward options.
If the player does not support Rewind/Prev/etc options the menu only shows what's supported.
Rewind and Forward menu options will go 10 seconds

also you can left click the Tray icon to open the window
In the window the players are listed with controls and a position slider (if available)

It's new and pretty untested and may give some errors yet but maybe you like the idea and it inspires you to do better :)

Todo:
Add Volume and other controls but i cannot get the Volume DBus command to use a Double (Float) instead of a Variable
Sort out the interface as it needs to be flashy/cool/changable :)

Much much much more error checking and improvements.

Re: mpris media controller (WIP)

Posted: Monday 30th January 2023 3:29pm
by BruceSteers
Okay , updates...

I figured out Volume , also how to set LoopStatus and Shuffle

Added a signal watcher that detects DBus MPRIS events like Volume/Position changes so updates instantly.
(Seems there is no way to tell what program sent the signal so on getting notification it checks all controllers)

I removed the Info Label and put the info in a Tooltip to make it more compact

Position slider/Volume/controls will hide what's not available

Still a long way to go but it's coming along nicely :)

Re: mpris media controller (WIP)

Posted: Tuesday 31st January 2023 4:44pm
by cogier
I have downloaded your program to see if it could help me, but it crashed.

When I clicked on the TrayIcon I got a blueish rectangle in the middle of the monitor, nothing else, just a blue rectangle. I clicked on the 'PlayerControl' button that caused the crash.

Is it me or some other issue?

Image

Re: mpris media controller (WIP)

Posted: Tuesday 31st January 2023 5:43pm
by BruceSteers
hmm, I've done a few updates since and cannot get the error on Cinnamon , it seems to work (ish)

Did you have no mpris players loaded at the time? (I've since added handling to not open the window if no players exist)
Players I know of so far...
Firefox video, SMplayer, VLC, Spotify

SMplayer is not great, it always reports it's volume as 0.4 regardless what it's set to, this causes a glitch in the program i need to account for :-\

Also there seems to be a position sliding issue where sometimes the slider updates to the current position before it sets the position to somewhere else after sliding.

Re: mpris media controller (WIP)

Posted: Wednesday 1st February 2023 2:55pm
by cogier
Hi Bruce, Sorry, I am not having much luck with this.

I doesn't seem to matter what I do, nothing, other than 'Quit', appears on the menu.

Image
Image

I was going to try Firefox but on relaunching the program it put a 'No Entry' sign on the taskbar and the Console in Gambas announced 'gb.desktop: unable to get icon for file:'.

What I am after is to allow Mint to be able to access my program as YouTube can, through Chrome, as you can see in the second picture.

Re: mpris media controller (WIP)

Posted: Wednesday 1st February 2023 5:50pm
by BruceSteers
Maybe if you give your program it's own mpris interface? then the existing controller will probably see it?

Dunno why you have problems with the program?
it works here.

Re: mpris media controller (WIP)

Posted: Thursday 2nd February 2023 12:49pm
by cogier
OK Thanks, I'll have to look into MPRIS.

Re: mpris media controller (WIP)

Posted: Saturday 4th February 2023 2:47pm
by BruceSteers
cogier wrote: Thursday 2nd February 2023 12:49pm OK Thanks, I'll have to look into MPRIS.
oooh it's complicated.
So far I have a half built project that adds mpris to MediaView

My DBus experience is not good enough i think though.
I think i'll add another post about it and see if anyone can help make it work properly.

Re: mpris media controller (WIP)

Posted: Saturday 4th February 2023 3:48pm
by cogier
Hi Bruce, please don't go out of your way on my account. I just thought that it would be easy, which, it obviously isn't!

Re: mpris media controller (WIP)

Posted: Saturday 4th February 2023 5:43pm
by BruceSteers
Aah but it's worth it 😎

Did you sre my post on the m/l ?
I'm part way there
https://lists.gambas-basic.org/pipermai ... 78331.html