Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
brocker
Visitor

Re: Roku Developers - Seattle?

Thanks everyone,

So Joel, the project is one that I think should be fairly straight forward. Basically we have videos as BrightCove, and a database running in the cloud. Here are the steps we are hoping to achieve:

1. User opens our Channel from store
2. Roku reads from registry to get user information
______2.a. This would be information saved on initial login where they would enter a email address from a login screen.
3. Roku calls a web service passing email address
4. A customized XML will be returned to Roku to populate Poster Screen

Any thoughts of where to start building?

Thanks
Bud
0 Kudos
jbrave
Channel Surfer

Re: Roku Developers - Seattle?

Well, the simple approach:

First create an roURLTransfer object to get the xml, and a few other items to process it:


sub main()
xfer=createobject("rourltransfer")
xml=createobject("roXMLElement")
xfer.seturl("http://brightcove.com/urlforXMLyouWantToGet")
xmlxfer=xfer.gettostring()


Ok, so now you have your data transfered to a string called xmlxfer. Now you want to parse it and simultaneously check that it is readable:

if xml.parse(xmlxfer) then


so if your XML looks like this for example:

<videos>
<video>
<vid_title>myvid</title>
<url>http://video.url</url>
<img>http://video.thumbnail.url</img>
</video>
<video>
<vid_title>myvid</title>
<url>http://video.url</url.
<img>http://video.thumbnail.url</img>
</video>
</videos>


then your code might look like this:

if xml.parse(xmlxfer) then
posterarray=createobject("roarray",1,true)
for each v in xml.videos.video '(I could be wrong about this, it might be xml.video, but I'm writing off the top of my head)
poster=createobject("RoAssociativeArray")
poster.shortdescriptionline1=v.getnamedElements("vid_title").GetText()
poster.HDposterURL=v.getnamedElements("img").gettext()
poster.SDposterURL=v.getnamedElements("img").gettext()
poster.vidurl=v..getnamedelements("url").gettext()
posterarray.push(poster
next
end if


Next step create and display poster screen:
posterscrn=createobject("roposterscreen")
posterscrn.setccontentlist(posterarray)
posterscrn.show()



Now you need a message loop to wait for message. First create a port, then assign the message port to the screen (really, assign the screen to the port)

port=createobject("romessageport")
posterscrn.setmessageport(port)
while true
msg=wait(0,port)
if type(msg)="roPosterScreenEvent" then
if msg.islistitemselected() then
ndx=msg.getindex() 'the index of the selected poster
'here is where you would put the code to do whatever it is you want to do with the poster, usually call a function to play the video
end if
end if
end while
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
brocker
Visitor

Re: Roku Developers - Seattle?

Man!! This is great, thanks! I'm building a test harness project now to go through your example.

I'll be in touch with any questions, this is great!

Best
Bud
0 Kudos
kbenson
Visitor

Re: Roku Developers - Seattle?

0 Kudos

Re: Roku Developers - Seattle?

You'll get great support from other developers just by asking your questions here. I should have mentioned that first, but was in a bit of a rush out the door when I made my last post to this thread.

It looks like you've gotten most of your answers right now, but feel free to come back with more questions if you run into problems.

I'll let you know when I'm in the Seattle area. It would be cool to 'talk shop' with someone face to face.
0 Kudos
brocker
Visitor

Re: Roku Developers - Seattle?

Yeah, thanks @RyanMarquiste, for sure ping me when you arrive!
0 Kudos