Scroll to the bottom if you want the TLDR version of controlling Roku devices from restricted Windows Phone devices
I recently purchased a Roku Streaming Stick after reading some great reviews online, and verifying it comes with Windows Phone support. Hooking it up to the TV was easy enough, and I was quickly able to enjoy streaming content using the included remote.
However, to my dismay I soon realized the remote was defective, intermittently entering a non-responsive state where all key presses would be ignored. I was peeved, of course, but I thought to myself – no big deal, I’ll just use the WP remote app, right?
Wrong. I tried the Roku official app, as well as literally every other Roku remote app on the WP store, to no avail. Most of the apps wouldn’t recognize my Roku device, with the official app saying “no Roku devices were found on your network” and “could not access the information of your Roku device(s)”. When I tried manually connecting to the Roku’s IP (as indicated in the Roku’s network settings page), the official app said it “Failed to connect to the specified device”. The few apps that did seem to “connect” to it could not control it – I would press a button and nothing would happen.
In my despair, I contacted Roku support. The representative quickly determined it was due to my location (Israel), which is not officially supported by Roku. Say what? The device work, its remote (mostly) works, but an app that merely simulates a remote suddenly cares about your location and deliberately fails just for spite? I didn’t buy it.
So I went to the Windows Store on my PC and installed the Roku Windows Store app. It immediately recognized my device and lo and behold – it was able to control it effortlessly. Motivated by my discovery, I powered on an old Android device and Installed a Roku remote app. Again, it worked right out of the box.
At this point I became very curious. Why were the WP apps failing? It can’t be a coincidence, especially considering the fact that many reviewers confirmed those apps did in fact deliver on their promise and controlled the device. To satisfy my curiosity, I referred to Roku’s REST API documentation. It literally could not be any simpler. Want to press the Home key? This is all you need to do:
curl -d '' http://192.168.1.134:8060/keypress/home
There’s no way all the Roku apps in the WP store got something as simple as this wrong. But seeing how simple the API was, I realized it would be a matter of hours to create a simple WP app that sends these commands and be done with it. I even had a name for my app – RemoRoku. It would be the savior of all Windows Phone Roku users, and I would be forever renowned as the hero of the community.
In reality, I quickly realized why all the other apps were failing. A few XAML tags and a single HttpClient call later, my app revealed curious behavior. The app would work fine on the emulator, but the device itself kept blocking the HTTP requests with 404 Not Found errors.
After a bit of searching on the web I ran into this thread. It mentions a similar phenomena, explaining how “regular” domain requests (e.g. microsoft.com) would work whereas IP requests (e.g. 192.168.1.134) would fail. The author ended up figuring out the root cause of the issue – a missing app capability by the name of privateNetworkClientServer. Unfortunately, setting it in my app’s manifest had no effect (which is not surprising, considering that the docs state it is equivalent on WP to internetClientServer _which was already enabled)._
At this point I had to assume something was blocked specifically on my phone. Maybe it was the specific hardware/software combination (Lumia 920, WP Denim), or more probably some enterprise Mobile Device Management (MDM) policy set by my workplace (I do work for Microsoft, after all ). Out of curiosity, I looked for such a policy in the WP MDM docs and couldn’t find one, but perhaps it is an implicit side effect of some other policy. It’s possible that the upcoming Windows 10 update will change things, but at this point in time it doesn’t seem like there’s anything I can do about it on my end.
I was undeterred, however. As the saying goes – If the mountain won’t come to Muhammad, then Muhammad must go to the mountain. Windows Phone wants a “real” domain and not and IP? I’ll give him one, by rewiring the DNSMasq rules in my DD-WRT router to redirect a made-up domain of my choice to the Roku’s IP. Using a rule as simple as
I was able to trick the HttpClient by sending my requests to ohadroku.com, and it worked from the device as well. I then went back to one of the Roku apps that allows you to use a domain name to identify the Roku device (the official one forces you to use an IP address) and typed in my made-up domain. Brimming in anticipation, I clicked the Home button on the WP remote app and sure enough – the call went through to the Roku device, which executed the command flawlessly.
If your router doesn’t support domain redirection, you can use a domain you own to do a similar trick. For example, I could have simply added a DNS A record mapping roku.ohadsoft.com to the router’s IP and it would have worked the same. This might be confusing since the router’s IP is not an internet-accessible address, but inside your private network it doesn’t matter. The app would resolve roku.ohadsoft.com (using an actual DNS server) to the router’s (internal) IP address, and since the app is working from inside the network as well, the requests would work.
This spelled the end of RemoRoku before it was even born, and with it my inevitable rise to fame and fortune. I guess you can’t win them all!
The DNSMasq rule did have one unfortunate side effect though – it seems that Plex secure connections require additional configuration in order to work alongside it, and that configuration is not supported on DD-WRT without compromising security or switching a DNS provider (which I did not feel like doing at 4 AM). So I just approved insecure Plex connections inside my private network – I trust my WPA2 protection so I won’t lose much sleep over this.
- Redirect a made-up domain of your choice to your Roku’s IP address (you can find it in its network settings). This must be done at the router / DNS level, so look for instructions depending on your setup. In DD-WRT you add something like this to the Services -> Additional DNSMasq Options box: address=/ohadroku.com/192.168.1.134. For more information see this article.
- Go to the Windows Phone Store and download a Roku remote app that allows you to specify the Roku’s address using a domain name and use your made-up domain. I used Remote 4 Roku Free.
- Enjoy your functioning WP Roku Remote!