Music controls

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

Music controls

Post by cogier » Friday 19th August 2022 3:45pm

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: 35
Joined: Saturday 4th September 2021 11:29pm

Re: Music controls

Post by thatbruce » Friday 19th August 2022 6:18pm

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

BruceSteers
Posts: 887
Joined: Thursday 23rd July 2020 5:20pm

Re: Music controls

Post by BruceSteers » Saturday 20th August 2022 12:21am


User avatar
cogier
Site Admin
Posts: 913
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Music controls

Post by cogier » Saturday 20th August 2022 3:46pm

Thanks Bruce. I think, as thatbruse says, this would not be easy. I'd need to understand dbus first.

bill-lancaster
Posts: 164
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: Music controls

Post by bill-lancaster » Sunday 21st August 2022 7:09am

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: 913
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Music controls

Post by cogier » Sunday 21st August 2022 11:26am

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.

BruceSteers
Posts: 887
Joined: Thursday 23rd July 2020 5:20pm

Re: Music controls

Post by BruceSteers » Saturday 17th September 2022 7:09am

Here's a simple way :)
xdotool key XF86AudioRaiseVolume
xdotool key XF86AudioLowerVolume
xdotool key XF86AudioMute

User avatar
cogier
Site Admin
Posts: 913
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Music controls

Post by cogier » Saturday 17th September 2022 9:23am

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