Page 1 of 1

Music controls

Posted: Friday 19th August 2022 3:45pm
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

Re: Music controls

Posted: Friday 19th August 2022 6:18pm
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

Re: Music controls

Posted: Saturday 20th August 2022 12:21am
by BruceSteers

Re: Music controls

Posted: Saturday 20th August 2022 3:46pm
by cogier
Thanks Bruce. I think, as thatbruse says, this would not be easy. I'd need to understand dbus first.

Re: Music controls

Posted: Sunday 21st August 2022 7:09am
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!

Re: Music controls

Posted: Sunday 21st August 2022 11:26am
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.

Re: Music controls

Posted: Saturday 17th September 2022 7:09am
by BruceSteers
Here's a simple way :)
xdotool key XF86AudioRaiseVolume
xdotool key XF86AudioLowerVolume
xdotool key XF86AudioMute

Re: Music controls

Posted: Saturday 17th September 2022 9:23am
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).