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: 
PaulFairless
Visitor

Channel Linking

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
0 Kudos
1 REPLY 1
RokuJoel
Binge Watcher

Re: Channel Linking

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



- Joel
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.