Streaming web video to Roku

gbtv picture gbtv · Dec 8, 2012 · Viewed 7.9k times · Source

Does anyone know how technically to send videos (i.e. Youtube Videos) to a Roku player? There is a "Twonky Beam" app that allows streaming and what it appears to do is to send .mp4 files to Roku for playback. See the demo here: http://gigaom.com/video/youtube-on-roku-twonky-airplay/

This is done without a "Twonky Beam" Roku app. Looks like something that Roku supports natively, although I cannot find anything documented.

I want to know how they were able to accomplish this without Roku being a UPNP or DLNA device.

Any insights here would be great!

Answer

alphablender picture alphablender · Dec 8, 2012

There are discussions on how to extract the mp4 URL from YouTube here and here

In terms of how to do airplay style video playback on Roku, you would use the External Control Protocol to launch a channel with the URLs of the video you wish to play back, or once your channel is launched, us the ECP in combination with the roInput component to send the URL's to your channel. Your channel would then send the URLs to a video playback compoenent which would initiate playback from Youtube or whatever source you send it. If you want to play URL's from your device (android/IOS) you would need to run a web server on the device to serve videos to the device.

here is an Open Source YouTube project referenced in that second thread.

Any unofficial project that plays video's from YouTube is subject to DMCA takedown by YouTube should they decide your project does not fit with their goals.

roInput is not really well documented, here is an example that demonstrates both roInput and launch parameters (launch parameters are keywords you include in an http POST):

function main(params as object)

    if params.parameter <> invalid then 
        print "This channnel was launched with Launch Parameters!"
        print params
    else
        print "launched without input parameters"           
    end if

    port=CreateObject("roMessagePort")
    input=createobject("roInput")
    input.setmessageport(port)


    while true
        msg=wait(100,port)
        if type(msg)="roInputEvent" then
          params=msg.getinfo()
          print params
         end if
    end while
end function

so your parameters might be "vidurl=http://myserver.com/video300k.mp4&vidurl=http://myserver.com/video600k.mp4" if you wanted to send multiple bit rate videos.

there are plenty of examples of how to play video on a Roku in the RokuSDK, the simplest being the simplevideoplayer exmaple.

As to the last part of the question re UPNP, you can find a roku on your lan either via brute force telnet on port 8060 to every ip or by using SSDP, also documented in the ECP guide linked above