Hi,
I’m developing a Roku channel, and one of the required features is to launch another channel when a user presses a key - from an advert for example. I know how to capture the key press but I don’t know how to launch a 3rd party channel. Using the Roku External Control Protocol I can see how it’s possible externally. Is it possible to issue these commands from within a channel?
I have seen an example in the Roku Newscaster channel so hope it is possible
Any help is most appreciated
Paul
You just need the ID of the channel to launch. However, the channel must be published (double check though, this may have changed) before you can actually test this, so test with the id of a published channel and then put in the correct id before publishing.
Here is an example:
Function launch(id as string, seconds=5 as Integer) as String
val=""
timeout% = 1000 * seconds
xfer=createobject("roURLTransfer")
str = ""
xfer.seturl("http://"+getip()+":8060/launch/11?contentID="+id)
?xfer.geturl()
port=createobject("romessageport")
xfer.setport(port)
if (xfer.AsyncPostFromString(val))
event = wait(timeout%, port)
if type(event) = "roUrlEvent"
print "1"
str = event.GetString()
elseif event = invalid
print "2"
?"AsyncPostFromString timeout"
xfer.asynccancel()
else
print "3"
?"AsyncPostFromString unknown event"
endif
endif
?
return str
End Function
function getip() as string
di=createobject("rodeviceinfo")
temp=di.getipaddrs()
temp.reset()
while true
aakey=temp.next()
if not temp=invalid then
return temp[aakey]
end if
end while
end function