Thanks a lot, mkirsten!
That was a great idea! Didn't think of trying the keyboard for similar behavior & missed the sendkey command altogether, too bad it is not fully completed yet.
So my Problem is *almost* completely solved, but I couldn't yet copy the Menu button function.
In the menus it needs to go "back", and in the OSD it needs to hide it,
so I'm still using the workaround alternating the "back" and "toggleOSD" commands when playing or paused (polling the client for the state every second),
as the submenus for video & audio will not be closed using "toggleOSD". Only disadvantage is that every other click simply does nothing after playing around in the menus while playing/paused.
For the rest I actually used both your suggestions:
The Select/Play/Pause function seems to be exactly the "Return" key, which actually works by the sendkey HTTP command :)
http://MacPro.local:32400/system/players/mac-mini.local/application/sendKey?code=13
The keyboard cursor keys are also exactly the left/right/up/down buttons from the remote, but I found no way to sendkey them, guess its only ASCII characters that can be submitted.
so I used a simple Apple script for each of the cursor keys (remove the "--" from the command you need):
on run
tell application "Plex"
activate
tell application "System Events"
--key code 123 --left
--key code 124 --right
--key code 125 --down
--key code 126 --up
-- these below worked too, but I used sendkey & navigation HTTP-API commands instead:
--keystroke return -->select/Play/Pause
--keystroke "m" --> toggles the OSD
--key code 53 --> ESCAPE key, going back
end tell
end tell
end run
The script is pretty quick from within my Realbasic app, so I even can quickly press the buttons if I need to.
So the sum up of my kindly request for the Plex developers:
1. Including a copy of the remote controls "Menu/back" button, the "Enter" key and the cursor functions into the HTTP API would be much appreciated
2. The polling for the current client state using "http://MacPro.local:32400/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying"
seems to be a bit limited for several users who want to integrate the Plex client into their home cinema environment,
so it would be great to have a event callback function in the plex client that one could either hook into via some .dylib/.dll
or some IP-socket events that could be send to a pre-defined listener destination.
(easier to access, but this would need a settings field where the user can enter a network-address where these events are sent to)
This could easily provide much more events than just playing/paused/stopped etc.
For example to get information when Volume up/down is pressed while using digital output, to remote control an Audio-Video-Receiver instead of the internal volume
(I'm using my Apple remote for changing the volume of my AVR while Plex is playing, otherwise I control Plex with it; But doing this I cannot give Plex.app itself the full control over the remote)
3. For others who can't or don't want to code their own application for this, it might even be useful to include a simple serial command option, at least for volume up/down of an external AVR instead of changing the volume of the computer.
Settings for the user to select would be just a few: COM-Port, Baudrate, Bits, Parity, Stop-bits, XON, CTS and DTR. Plus the two individual commands to enter for master volume up & down of the AVR.
For example, for my Denon this is simply "MVUP"+chr(13) and "MVDOWN"+chr(13)
Hook up a serial cable, finished. B)
Thanks again!