plexinc/roku-client-public — Issue #52: Support player/controller API
Author: sullman
Created: 2012-03-07 18:22:41+00:00
State: open

It would be nice if the Roku client showed up in the list of clients that can be controlled using remotes on some of the other clients (e.g. iOS and Android). It's far from trivial though. A few notes I jotted down in a forum post.

- I'm not even sure it's possible. If the Plex app isn't currently running then it certainly can't respond to the HTTP API that the remote app would want to use.
- Roku does have its own API for external control (see the ExternalControlGuide.pdf included in the SDK). That could be used to launch an application, and I believe to send it arbitrary commands, but the current app doesn't respond to those messages.
- I believe it would be technically possible for our Roku app to listen for the HTTP and UDP messages that the server sends players, but it doesn't currently.
- The main hurdle for the last two bullets is that to really support those would involve some rearchitecting. I'm not sure if you are familiar with the Roku SDK (or if you want to be), but the gist of the problem is that every screen in our app uses its own MessagePort, but in order to handle arbitrary messages from the outside we'd need to use a single MessagePort across the whole application.

I think the way to go would be to open up some sockets and listen for HTTP/UDP messages on the ports that PMS sends to. So, don't bother trying to allow the app to be launched when it's not running, since that's roku specific and other clients only show up when they're running anyway. And I believe this is all possible, after all we do GDM discovery by listening for UDP messages while the home screen loads.

So the first step, which might be a doozy, would be to get the application using a single message port.