Pushing a HTTP Stream To Roku

18 Sep 2016 23:11

After a bit of traffic capturing, I managed to find out how to make Roku play an HTTP stream by URL.

It seems a Roku device (Roku TV in my case) hosts an HTTP server which is exposed on port 8060.

There's a series of MDNS requests to determine the available player in the network, but we can skip that since I assume you know the IP address of your Roku. After the device (a phone in my case) identified the target player, it sends an HTTP request:

GET http://your-roku-address:8060/query/device-info

You get a nice XML document in return that lists some properties like this:

<device-info>
   <udn>...</udn>
   <serial-number>...</serial-number>
   <device-id>...</device-id>
   <advertising-id>...</advertising-id>
   <vendor-name>Hisense</vendor-name>
   <model-name>Hisense 40H4</model-name>
   <model-number>5203X</model-number>
   <model-region>US</model-region>
   <screen-size>40</screen-size>
   <wifi-mac>...</wifi-mac>
   <network-type>wifi</network-type>
   <user-device-name/>
   <software-version>7.2.0</software-version>
   <software-build>4143</software-build>
   <secure-device>true</secure-device>
   <language>en</language>
   <country>US</country>
   <locale>en_US</locale>
   <time-zone>US/Pacific</time-zone>
   <time-zone-offset>-420</time-zone-offset>
   <power-mode>PowerOn</power-mode>
   <supports-suspend>true</supports-suspend>
   <developer-enabled>true</developer-enabled>
   <keyed-developer-id/>
   <search-enabled>true</search-enabled>
   <voice-search-enabled>true</voice-search-enabled>
   <notifications-enabled>true</notifications-enabled>
   <notifications-first-use>false</notifications-first-use>
   <headphones-connected>true</headphones-connected>
   <expert-pq-enabled>0.5</expert-pq-enabled>
</device-info>

You can see for example my device is Hisense 40H4 and it's a secure device.

This is interesting, but this doesn't cause anything to play.

Here's the part that gets Roku to play something:

POST http://your-roku-address:8060/input/15985?t=v&u=http%3A%2F%2F192.168.1.108%3A8000%2Fstream.m3u8&k=(null)&videoName=192.168.1.108%3A8000%2Fstream.m3u8&videoFormat=hls

That's it, you pass the m3u8 URI as u param (need to URL encode it first) and Roku starts playing it. Note the HTTP method used in POST, but the payload is empty.

I'm not sure what's the meaning of 15985 in the URL, maybe it's the ID of the PlayOnRoku video source.


More posts on this topic

Comments

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License