Music controls

Post your Gambas programming questions here.
Post Reply
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Music controls

Post by cogier »

If I go to YouTube in Chrome and play a song, a player control is available in the system tray.

Image

I would like to access this from within Gambas.

Has anybody got any idea how to do this.

Linux Mint 20.3 Cinnamon Desktop
User avatar
thatbruce
Posts: 161
Joined: Saturday 4th September 2021 11:29pm

Re: Music controls

Post by thatbruce »

I think that this would be either horrifying difficult or it would depend on something made public by the player application - dbus?
The horrible method would involve somehow finding the application icon on the screen and somehow activating it with generated mouse actions (and I dont think that is easy either).
b
Have you ever noticed that software is never advertised using the adjective "spreadable".
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Music controls

Post by BruceSteers »

If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Music controls

Post by cogier »

Thanks Bruce. I think, as thatbruse says, this would not be easy. I'd need to understand dbus first.
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: Music controls

Post by bill-lancaster »

I've just seen mps-youtube (and others) on the command line which I think could be run from EXEC[].
Just a thought!
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Music controls

Post by cogier »

I've just seen mps-youtube (and others) on the command line which I think could be run from EXEC[].
Just a thought!
Thanks Bill, but I have already written the player, and it uses youtube-dl to download the music I like. What I want to do is connect it to the built-in music controls that most distros have. As you can see above, Chrome allows Mint to control the playing of the track/video.
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Music controls

Post by BruceSteers »

Here's a simple way :)
xdotool key XF86AudioRaiseVolume
xdotool key XF86AudioLowerVolume
xdotool key XF86AudioMute
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Music controls

Post by cogier »

Unfortunately, these tools only do what I have already mastered. To change the volume I use: -
Shell "amixer -D pulse set Master " & Str(SliderVol.Value) & "%"
And to pause the music: -
MediaPlayer1.Pause()
I was after using the controls on the desktop to control my program (see picture in first post).
Post Reply