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

Adding a countdown or timer to a springboard screen?

Hi All,

Is it possible to add a countdown to a springboard screen (or create a custom screen with a countdown)? The scenario is i have a live feed that is only active during special events not 24/7. The client would like the ability to have a count down showing when the next live event starts. This would be updated each second as it counts down.

In searching the forum i found references back in 2006 and 2008 to a component called a "roTextWidget", which seemed to allow updating the text using a given period, but can find no trace of it in the current documentation. Can anyone point me in the right direction? Is it possible to do this? Ideally i would want to add the text in the description text area as line 1 but could also see it in the button area of the springboard layout.

Thanks
Jeff
0 Kudos
3 REPLIES 3
RokuJoel
Binge Watcher

Re: Adding a countdown or timer to a springboard screen?

You could update the content of the screen every second using screenVarName.setcontent(content) or you could have a function that updates the buttons on the screen every so often:

function reloadbuttons(screen as object, time as string) as object
screen.clearbuttons()
if time <> "0:00" then
screen.addbutton(0,time+" till show start")
else
screen.addbutton(0,"Play")
end if
return screen
end function


The trick is to set your msg=wait to a non-zero time so that it doesn't block execution and updates while waiting for a keypress:

msg=wait(1000,port) 'a one second wait.
0 Kudos
TheEndless
Channel Surfer

Re: Adding a countdown or timer to a springboard screen?

You'd also want to be sure to set UseStableFocus() to true, otherwise the selected button will reset to the first button on every refresh. If you're updating every second, that could get very frustrating for your users.. 😉
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jmacfl
Visitor

Re: Adding a countdown or timer to a springboard screen?

Excellent, thank you! I will give this a try.
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.