Keyboard Multimedia Keys (2 Viewers)

sean2078

Portal Member
August 10, 2006
7
0
Hello everyone.

It might be just me, but my multimedia keys on my keyboard do not seem to control MediaPortal. For example, if I hit next track on my keyboard while playing music, the next track does not play.

I know I can switch to the program and then hit F8, but I use MediaPortal along with other apps and its a real pain having to switch to the program just to pause or play the next track. Having this not work really sucks compared to all other media players.

I don't have an MCE keyboard - it's a standard next-gen Dell.

Does anyone have any ideas? :?:

Thanks much,
S.
 

Paranoid Delusion

Moderation Manager
  • Premium Supporter
  • June 13, 2005
    13,052
    2,978
    Cheshire
    Home Country
    United Kingdom United Kingdom
    If MP is not the point of focus, ie running in the background then it will not respond, and the chances in the near future unlikely.

    8)
     

    sean2078

    Portal Member
    August 10, 2006
    7
    0
    mPod helped me with the answer to this recently.

    FYI - to enable global keyboard shortcuts HID must be enabled. I'm not an expert on what you can or cannot do with it, but the multimedia keys work through it at least. for all those who are new the system, HID can be found under "Setup" -> "Remote" -> "General HID".

    To enabled mulitmedia keys on your keyboard, "Use general HID device" must be enabled.

    -S.
     

    sean2078

    Portal Member
    August 10, 2006
    7
    0
    Ah crud. -- I just realized that the multimedia keys on my keyboard only control the app when it has focus (like others have said).

    Can anyone help get me started on how to control this media player with multimedia keys? :) I use MediaPortal as my media player on my second monitor and it doesn't always have focus.

    Thanks.
     

    shewless

    Portal Pro
    October 2, 2006
    71
    0
    Home Country
    Canada Canada
    I noticed with my imon PAD remote I can control the system volume from whatever application I'm in - MP, a game, whatever.
    Shouldn't be a far stretch to take general HID device input (like play pause, etc) and make windows receive them and then do something with them?

    Can anybody explain or shed some light on how you could have Mediaportal running an external program, but still listening for certain key commands?
     

    Smirnuff

    Portal Pro
    December 7, 2004
    630
    3
    United Kingdom
    Can anybody explain or shed some light on how you could have Mediaportal running an external program, but still listening for certain key commands?

    You would need to use a CBT hook to globablly capture any key press. You'll find code and a pre-compiled assembly for mphook in the mptray archive available in the download section of the main site.

    You could modify the above assembly so that it is a process plugin, install the hook and then post the key press to MP as normal when the application is not focused. This will allow you to control MP regardless of whether the application has focus or not.
     

    shewless

    Portal Pro
    October 2, 2006
    71
    0
    Home Country
    Canada Canada
    Hmmm.. I'm not sure if I could do that on my own... I'll take a look at the code... any idea how much effort this would take for somebody new to MP with a general knowledge of coding? What about for somebody who is an MP expert coder?

    Thanks
     

    Smirnuff

    Portal Pro
    December 7, 2004
    630
    3
    United Kingdom
    There's nothing overly MP specific about this, only making the assembly a process plugin which is covered in a tutorial on the forum and then identifying, and if necessary borrowing, the piece of code that MP itself already uses to dispatch key presses.
     

    Smirnuff

    Portal Pro
    December 7, 2004
    630
    3
    United Kingdom
    Naturally the cleaner way would be to add the code from mphook to the RemotePlugins project, then add an extra option to the HID property page for handling commands when unfocused. If the option is checked add the call to install the hook to HidListener's Init method. In the delegate that handles the CBT callback you would call the HidListener's WndProc method and thats all there would be to it, you'd even get key mapping for free.

    Test and then submit a patch to SF and you've got yourself a useful contribution within 5 posts.
     

    Users who are viewing this thread

    Top Bottom