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!