Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
vznzj7
Level 7

Device Linking using InstantTV for Channel Creation

I am using InstantTV for creating my channel. It was cool up until this point wherein I have to link my Channel to the Roku devices.

I was able to get the authorisation code in the TV (which in turn generates the registration xml file in my S3 bucket). However I dont have the server side code to validate the code and generate an response so that users can be linked.

The PHP code that they provided creates 2 xml files, one for linking and another for adding the user. here are the 2 sample files. Even if I upload these 2 files manually into my amazon buckets, that still doesnt work.

Linking.xml
=================
<?xml version="1.0" ?>
<linkResponse>
<status>success</status>
<deviceID>xxxxx</deviceID>
<customerID>xxxx</customerID>
<customerEmail>xxx</customerEmail>
<creationTime>2015-08-11T17:36:01.666Z</creationTime>
<command>Activate</command>
</linkResponse>

Account.xml
==================
<?xml version="1.0" ?>
<account>
<tokens>
<token>xxxxx</token>
<deviceID>xxx</deviceID>
<deviceTypeID>xxx</deviceTypeID>
<firmwareVersion>xxx</firmwareVersion>
<requestTime>2015-08-11T17:36:01.666Z</requestTime>
</tokens>
<maximumDevices/>
<customerEmail>xxxx</customerEmail>
<creationTime>2015-08-11T17:36:01.666Z</creationTime>
</account>

There are no sample server side code available anywhere to do this coding for the PHP. Got little lost. InstantTV support is also not forthcoming on how to set this up. Any guidance would definitely helpful.

I just need to know once the user enters the code in the website, What happens on the backhand, what are the files generated? how should those file be stored in the amazon bucket?
0 Kudos
2 Replies
Ace
Level 7

Re: Device Linking using InstantTV for Channel Creation

Did you ask Scott at Instant TV Channel? He can pretty much do anything if you ask him.

Ace
0 Kudos
OddScott
Level 7

Re: Device Linking using InstantTV for Channel Creation

If you want to handle the server-side operations yourself instead of using the free WordPress plugin, here's the API: http://ex.irchan.com/docs/irc_reg_and_link.pdf

The Roku device writes the registration file to an S3 bucket and then displays a code on the TV screen that's actually the name of the file that it just wrote. Then the server uses that same code, provided by the subscriber, to read the registration file. Inside the registration file, among other things, is a token that is used as the filename of the linking file that the server writes to another S3 bucket. The Roku device knows what the token is (since it provided it to the server in the first place), and it uses the token to read its linking file from the S3 bucket. The linking file contains instructions from the server indicating whether or not the protected video is allowed to be played, whether or not to delete the token (subscriber didn't pay their bill) or an optional message to display to the subscriber.

You'll need to customize the linking file to match what's in the registration file, you can't just copy the example from the docs. At a minimum you'll have to name it the same as the token provided by the Roku device in the registration file.

The files in the account bucket are specific to the WordPress plugin. They allow the plugin to match up the files in the linking bucket to the WordPress login ID of the customers they belong to. The account files aren't written to or read by the Roku device, and if you aren't using the provided WordPress plugin then they aren't needed at all.

There IS sample server-side code provided on the Instant TV Channel documentation page at http://www.InstantTvChannel.com/roku/wordpress. Here's the link to the code: http://ex.irchan.com/wp_irchan.zip. It's non-obfuscated PHP with hopefully enough comments to let you know how it works. I think the API document will probably be more helpful than the code if you aren't using WordPress. The sample code is somewhat minimal, you might want to add a more extensive reporting system or integrate it directly into your subscriber management system.

- Scott
www.InstantTvChannel.com - Build a Roku channel in 5 minutes!
0 Kudos