# [OBS Multiplatform] How to get Key Press Events from the API?



## Snapdragon (Jan 21, 2016)

Hello all,

First time posting so let me know if this is in the wrong place etc.

I've been having some difficulty reading the API for OBS MP to find a suitable way for my plugin to read the last key that was pressed whilst a particular Source is showing.

Thanks,


----------



## dodgepong (Jan 21, 2016)

What are you trying to do?


----------



## Snapdragon (Jan 21, 2016)

The aim is to display keys pressed like an overlay, but I didn't want to go the route of making a keyboard hook, as I thought it might be possible with the API already.


----------



## Jim (Feb 6, 2016)

We have a hotkey API.  Not entirely sure if that's what you're aiming for, however.


----------



## Snapdragon (Feb 6, 2016)

I noticed, but couldn't see how to utilise it properly.(Never used/written for OBS before this)

I'd need to be able to recognise any key press instantly, not just pre-defined hotkeys?


----------



## Jim (Feb 6, 2016)

Hm, I don't quite know how I feel about recognizing any input as it comes in.  I'm not sure how I feel about that sort of thing being part of the base API.  Besides, it's a lot of work/maintenance for a potentially niche use-case.  Not saying I won't do it however, I feel like I just need a bit more convincing.  There is a related pull request on the repo for something similar, but I haven't heard of actual specific use-cases and what people are trying to achieve with it.


----------



## Snapdragon (Feb 6, 2016)

Understandably so, I went into this not expecting the API to be able to do so, but after seeing so much involving hotkeys I thought it best to ask.

I'm not sure of many other use cases but I'm doing my dissertation project around this idea of creating a key overlay as an actual plugin. Which as of right now requires a Keyboard hook in its current implementation (Not ideal for my ethical considerations).

If you have anything you could throw my way to point me in the right direction though, that would be greatly appreciated :)


----------

