Detect remote control press from addon
#1
Hi All,

I would be very greatful if some-one could assist with the following.

I would like to be able to detect when the user presses things like "play", "Volume Up/Down", "pause" etc from the remote control from within my python Addon.

Is there a way of doing this? The reason it to enable remote control support for the Sonos addon. At the moment it brings up a dialog, and while that dialog is up I would like to intercept the remote control operations.

Thanks

Rob
Reply
#2
It looks like the windows onAction may notif me of things pressed.

However, will this only send it to my addon? - i.e. if the user does "Up Volume" can I intercept it - and then process the up volume without XBMC processing it as well?

Or will the master XBMC also do the up volume?

Thanks

Rob
Reply
#3
I think you meant this post for the development section?

But in short, you need to define OnAction, take a look at this:
http://wiki.xbmc.org/?title=Action_IDs

example:

Code:
#get actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
ACTION_PREVIOUS_MENU = 10
ACTION_SELECT_ITEM = 7

  def onAction(self, action):
    if action == ACTION_PREVIOUS_MENU:
      self.close()
    if action == ACTION_SELECT_ITEM:
      self.message()

For XBMC to ignore captured action, I think you need to focus control on your addon window...

More Info:
http://wiki.xbmc.org/index.php?title=HOW...s_for_XBMC
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#4
Oops, sorry for posting in the wrong section!

Thank you for your help (again!) I will give it a go and see how I get on.

Thanks

Rob
Reply
#5
Hi Lunatixz,

I've managed to get a minute to try this. I can pick up things like volume-up now.

Unfortunately, so does XBMC - so it ups XBMCs volume - not just the dialog that I have created and opened (Tried both show and doModal)

Any ideas how I can stop XBMC picking up these commands?

Thanks

Rob
Reply

Logout Mark Read Team Forum Stats Members Help
Detect remote control press from addon0