18 Sep 2016 23:11
TAGS: hls http roku stream
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:
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:
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.