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

Timed event within roSpringboardScreen

Hello,

I was wondering if there was a way to add a timed event to fire every 10 seconds or so. For example, if you're sitting on the springboard screen, ever 10 seconds the star rating could get checked or something. Is that possible?

Thanks!
0 Kudos
5 REPLIES 5
RokuChris
Roku Employee
Roku Employee

Re: Timed event within roSpringboardScreen

0 Kudos
RokuJoel
Binge Watcher

Re: Timed event within roSpringboardScreen

Yes. You could use msg=wait(600000,port) or you could set up a timer:


timer=createobject("roTimeSpan")
timer.mark()
While True
msg=port.getmessage()
if timer.totalseconds() > 600 then
content.starRating=checkStarRating()
timer.mark()
screen.setcontent(content)
end if
if type(msg)="roSpringboardScreenEvent" then
if msg.isbuttonPressed() then
if msg.getindex() = 0 then
playContent(content)
else if
...
0 Kudos
alexboyer
Visitor

Re: Timed event within roSpringboardScreen

Ah so you can check for multiple event types within the same while loop? Nice. Thanks!
0 Kudos
RokuJoel
Binge Watcher

Re: Timed event within roSpringboardScreen

Yes. There may be some instances where it works better to use a separate port and if/then statement, specifically if you have an roScreen and async roURLTransfers, probably best if they are each on their own port.

- Joel
0 Kudos
alexboyer
Visitor

Re: Timed event within roSpringboardScreen

Wanted to let you know that suggestion worked very well. Thanks Joel!
0 Kudos