Music controls

Post

Posted
Rating:
#1 (In Topic #888)
Avatar
Guru
cogier is in the usergroup ‘Guru’
If I go to YouTube in Chrome and play a song, a player control is available in the system tray.

<IMG src="https://www.cogier.com/gambas/MusicPlayer.png"> </IMG>

I would like to access this from within Gambas.

Has anybody got any idea how to do this.

Linux Mint 20.3 Cinnamon Desktop
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 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

Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
apparently the cinnamon sound applet uses dbus mpris
MPRIS D-Bus Interface Specification - v2.2
Full Index
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Guru
cogier is in the usergroup ‘Guru’
 Thanks Bruce. I think, as thatbruse says, this would not be easy. I'd need to understand dbus first.
Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
bill-lancaster is in the usergroup ‘Regular’
 I've just seen mps-youtube (and others) on the command line which I think could be run from EXEC[].
Just a thought!
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Guru
cogier is in the usergroup ‘Guru’
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.
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
Here's a simple way :)
<HIGHLIGHT highlight="shell">
xdotool key XF86AudioRaiseVolume
xdotool key XF86AudioLowerVolume
xdotool key XF86AudioMute
</HIGHLIGHT>
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Guru
cogier is in the usergroup ‘Guru’
Unfortunately, these tools only do what I have already mastered. To change the volume I use: -

Code (gambas)

  1. Shell "amixer -D pulse set Master " & Str(SliderVol.Value) & "%"

And to pause the music: -

Code (gambas)

  1. MediaPlayer1.Pause()

I was after using the controls on the desktop to control my program (see picture in first post).
Online now: No Back to the top
1 guest and 0 members have just viewed this.