Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
alexboyer
Level 7

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
Highlighted
Roku Employee
Roku Employee

Re: Timed event within roSpringboardScreen

0 Kudos
Highlighted
Roku Employee
Roku Employee

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
Highlighted
alexboyer
Level 7

Re: Timed event within roSpringboardScreen

Ah so you can check for multiple event types within the same while loop? Nice. Thanks!
0 Kudos
Highlighted
Roku Employee
Roku Employee

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
Highlighted
alexboyer
Level 7

Re: Timed event within roSpringboardScreen

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