Keyboard Shortcuts; Multimedia Keys

Feature requests that have been implemented will be filed here.
oyvindo
Posts: 57
Joined: Tue May 05, 2015 6:56 pm

Keyboard Shortcuts; Multimedia Keys

Post by oyvindo »

Hi, I wish to be able to control Muso (both full screen and normal use) using keyboard Media Keys, and/or alternative function keys and/or <ctrl>-key combinations.
Please refer to this open source project as a reference and perhaps a starting point: https://github.com/borismus/keysocket
I installed the above to control Jamstash, and it works just perfect, but it could not support Muso. Probably because Muso does not run inside a browser, although Muso seems to have certain browser capabilities built-in, I haven't found out how to enter a URL in Muso's internal browser. Not that it would make much sense to be able to do it, unless it it would allow us to use third party plug-ins or extensions, like Keysockets, to Muso (?)

This page defines the Microsoft keyboard shortcut map for windows mediaplayer: https://blogs.windows.com/windowsexperi ... ltep6gp.97
musoware
Site Admin
Posts: 1847
Joined: Fri Sep 14, 2012 6:50 am

Re: Keyboard Shortcuts; Multimedia Keys

Post by musoware »

I did add support for the following standard keyboard media keys quite a while ago (version 1.4.20):

private const int APPCOMMAND_BROWSER_BACKWARD = 1;
private const int APPCOMMAND_BROWSER_FORWARD = 2;
private const int APPCOMMAND_MEDIA_NEXTTRACK = 11;
private const int APPCOMMAND_MEDIA_PREVIOUSTRACK = 12;
private const int APPCOMMAND_MEDIA_STOP = 13;
private const int APPCOMMAND_MEDIA_PLAY_PAUSE = 14;

These are standard microsoft codes - see https://msdn.microsoft.com/en-us/librar ... 46275.aspx

I don't happen to have a keyboard now with multimedia keys on so can't test it. Can anyone confirm if they work?
musoware
Site Admin
Posts: 1847
Joined: Fri Sep 14, 2012 6:50 am

Re: Keyboard Shortcuts; Multimedia Keys

Post by musoware »

NB. Muso is a .NET product and .NET uses the Internet Explorer engine internally in its browser object (which Muso uses). Therefore IE plugins should be inherited, but I cannot say for sure whether they will have any effect (probably not in the case of custom keystrokes).
oyvindo
Posts: 57
Joined: Tue May 05, 2015 6:56 pm

Re: Keyboard Shortcuts; Multimedia Keys

Post by oyvindo »

I'm using a Logitech Wireless Keyboard K520, and it actually does work - partially.

In my case, it turned out that the Keysocket Chrome PlugIn had intercepted and completely taken control of the media keys. Once I disabled it, things begin to happen.
However, if I have Mediamonkey running, it takes priority, even when running in the backgorund. But if I keep Muso in the foreground, media key-presses are passed first to Muso then to MediaMonkey and they both react - which perhaps is logical. If I switch to another desktop (in Windows 10), it seems to bring Muso out of focus, and the keys stops working for Muso but keeps working for MediaMonkey.

I understand that having two apps running concurrently trying to read the same set of keys, is not feasable, but I experimented with it just to see what was happening.
If I terminate MediaMonkey, Muso still looses attention if I switch desktops or bring another app to the front. Even switching desktop back to Muso doesn't help. I actually have to manually click somewhere within Muso to actively give it focus before it begins to interpret media keys again.
I guess your half-way there, if you only could make Muso also capable of responding to keys while in the background. As most music players just sit in the background while the PC is used for other stuff, it doesn't make much sense to have to bring it to the front every time I need to pause/skip or stop. Then I might just as well use the mouse.

I tried also running VLC in paralell with Muso, and got yet another result. VLC intercepts media keys, but fails to pass them on to Muso. Then I tried using Foobar 2000, and it too behaves just the same way as VLC. But FooBar properly handles MediaKeys whether in foreground or background, but gracefully hands control to Muso once Muso is in the foreground. I think that is the most correct way to behave.

Is that achievable with Muso? I mean, working both in foreground and background unless another app moves up in front?
musoware
Site Admin
Posts: 1847
Joined: Fri Sep 14, 2012 6:50 am

Re: Keyboard Shortcuts; Multimedia Keys

Post by musoware »

Not much I can do no, if another application intercepts the commands and does not pass them on, there's nothing I can do in Muso to change that, I doubt I can change the way Windows assigns a preference order to the sequence either. To my mind it makes perfect sense for the app in focus to take precedence.

Muso does pass them on by the way, which is why you are seeing what you are seeing. I'm wondering now whether it should if it uses them.
musoware
Site Admin
Posts: 1847
Joined: Fri Sep 14, 2012 6:50 am

Re: Keyboard Shortcuts; Multimedia Keys

Post by musoware »

NB. I've added a note to look to extend the media key support to include these as well, as they all make sense in the Muso context:
APPCOMMAND_BROWSER_HOME
APPCOMMAND_BROWSER_REFRESH
APPCOMMAND_HELP
APPCOMMAND_MEDIA_REWIND
APPCOMMAND_MEDIA_FAST_FORWARD
APPCOMMAND_VOLUME_DOWN
APPCOMMAND_VOLUME_UP
oyvindo
Posts: 57
Joined: Tue May 05, 2015 6:56 pm

Re: Keyboard Shortcuts; Multimedia Keys

Post by oyvindo »

Excellent!
All you need to do then, is make it work also while Muso is minimized (in the background)....
musoware
Site Admin
Posts: 1847
Joined: Fri Sep 14, 2012 6:50 am

Re: Keyboard Shortcuts; Multimedia Keys

Post by musoware »

oyvindo wrote:Excellent!
All you need to do then, is make it work also while Muso is minimized (in the background)....
Not sure I can - again I think that's windows deciding which application to send the commands to, minimising the app means it's not in focus.
oyvindo
Posts: 57
Joined: Tue May 05, 2015 6:56 pm

Re: Keyboard Shortcuts; Multimedia Keys

Post by oyvindo »

musoware wrote:Not sure I can - again I think that's windows deciding which application to send the commands to, minimising the app means it's not in focus.
No, that doesn't make sense. How come then that some apps do work while minimized, while others don't ? Their all running on the same machine under the same version of Windows!
It's gotta be the app and not Windows! :geek:
musoware
Site Admin
Posts: 1847
Joined: Fri Sep 14, 2012 6:50 am

Re: Keyboard Shortcuts; Multimedia Keys

Post by musoware »

Well, I'm willing to give it a shot.

EDIT: Looked into it, I can't find anything that .NET provides to make this work.
Post Reply