- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
message port for roInput not firing any events
I'm trying to handle remote control input, but I'm only seeing "invalid" for the message bound to an "roInput" object.
Do I need to add any flag to the manifest, I saw you need to for deep link launching but not sure about input events, nor could I find any examples of handling remote control input.
msgPort = CreateObject("roMessagePort") input = CreateObject("roInput") input.setMessagePort(msgPort) while (true) msg = wait(500, msgPort) if type(msg) = "roInputEvent" then print "got some input event yo" if msg.IsInput() info = msg.GetInfo() print "Received input: "; FormatJSON(info) end if end if
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: message port for roInput not firing any events
Did you read the documentation? It's not for receiving button presses from the remote control.
"An roInput object can be used to receive events sent from a network client using the External Control Protocol (ECP), as described in External Control API."
https://developer.roku.com/docs/references/brightscript/components/roinput.md
The reason you only see invalid events is because the wait statement times out before any events are received. If you want to wait forever you should have wait(0, msgPort). Your loop is going to be printing the invalid events twice a second.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: message port for roInput not firing any events
Thanks for pointing out my error, I found an example in SimpleAnimatedSprite that works, I needed to bind the message port to the screen, and then listen for "roUniversalControlEvent" events.