Jump to content

API issues with Roku


jvandy7

Recommended Posts

I'm trying to run the API call to start something playing on a Roku. I'm able to execute the API against a web based client to start playing something in that session. When I execute the API against a Roku client, I keep getting 500 errors.

 

curl http://server:8096/Sessions/c3d29a13fb7dd5aa7c5aa99aa0046ae7/Playing -X POST -d '{"Id":"c3d29a13fb7dd5aa7c5aa99aa0046ae7","ItemIds":"da301fe6ac07b3e85fffb49929eb6e81","PlayCommand":"PlayNow"}' -H "Accept: application/json" -H "Content-Type: application/json" -H "X-MediaBrowser-Token: ---------------------" -H 'X-Emby-Authorization: MediaBrowser Client="Roku", Device="Roku Ultra", DeviceId="YP0034023960", Version="2.25"' -v

 

I can replace all the variables above for a chrome or firefox session and it starts just fine.

 

Thanks!

Link to comment
Share on other sites

Yes, I set the Roku to the Emby app. Then I run the sessions query against the Emby server to get all the session details for the Roku client. Then run the curl command to set the playing item for the session.

 

I was able to find the stack trace from the server and the main exception is below. I can attach the full trace if you need.

 

System.AggregateException: One or more errors occurred. ---> MediaBrowser.Model.Net.HttpException: Unable to connect to the remote server

Link to comment
Share on other sites

When I use firefox with firebug, and then highlight the POST and choose "Copy as Curl"

 

curl -X POST "http://<my server ip>:8096/emby/Sessions/4df9c21cbf902e50e8e0420042adfedb/Playing?ItemIds=346f0e11ee98b8da3ad0a7403302df63&PlayCommand=PlayNow" -H "Host: <my server ip>:8096" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0" -H "Accept: */*" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "Referer: http://<my server ip>:8096/emby/web/home.html" -H "x-mediabrowser-token: <my token here>" -H "x-emby-authorization: MediaBrowser Client=""Emby Mobile"", Device=""Firefox 51.0"", DeviceId=""9e1420874bfdd65e6befb1a0172c2636"", Version=""3.1.5.0"", UserId=""ea4b2d910d8e4049a2f3b20c2ca789d1""" -H "Origin: http://<my server ip>:8096" -H "Connection: keep-alive" -H "Content-Length: 0"

 

Notice the roku isnt my mediabrowser client, or device, or deviceID. These should be the client you are sending from, not the client you are sending to. The session itself is tied to the roku, sending /Playing?Itemids through this will invoke the roku to do your bidding. This is probably the issue you are having. Making it look like the roku is sending to the roku, when the server knows that isnt true.

Edited by speechles
Link to comment
Share on other sites

Thanks, that works perfectly!! Now my integration with Echo + Emby + Roku works to have it turn on Live TV to whatever I want, wherever I want!

Link to comment
Share on other sites

You can also, start the emby app, from command line, just use the url below and throw it at your roku;

 

http://<ip of your roku here>:8060/launch/43157

 

Official Emby App is 43157

Preview Emby App is 120610

Emby Blue Neon Night App is 67397

 

You can issue this command, and then a sleep(10) or similar to give the roku time to launch the app and afterwards do your remote control process as usual.

 

You would use this to see what apps are on the roku:

http://<ip of your roku here>:8060/query/apps

 

If the app is on the roku, it can be launched.  If the app isnt on the roku you can use this to install:

http://<ip of your roku here>:8060/install/43157

 

To tell if the app is already running on the roku before you do your thing:

http://<ip of your roku here>:8060/query/active-app

Edited by speechles
Link to comment
Share on other sites

Yeah, thanks for those. I have the Roku functions down. My Emby apps are different, but it's easy enough to parse out the XML for the ID. I've also noticed you have to watch sometimes if it is sleeping or not, so I tend to send it home twice, then to Emby. And now I can start to play something on Emby.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...