Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a programmatic way to prevent Roku to go to screen

I am working on an application that waits for some time (several hours) and then play some videos and then wait again and then play videos again and so on.

Whether it is time to play content or it is time to wait is decided by the web service that provides the content to be played. In case, web service sends the signal that it is time to wait then my app pings the server every five minutes until it is time to play content.

The problem is while waiting and pinging Roku goes to screen saver mode. In the screen saver mode when the app pings server again screen saver jerks at first couple of requests (each request after 5 minutes) and then at next request Roku crashes and I have to restart the device.

So if there is a programmatic way to prevent Roku to go to screen saver mode? I am also showing a 300 seconds count down while waiting, it goes in the background too when screen saver starts.
0 Kudos
9 Replies
Roku Employee
Roku Employee

Re: Is there a programmatic way to prevent Roku to go to scr

That seems somewhat strange - which screensaver are you running that "jerks"? This sounds like a cpu usage issue clearly, either by the screensaver or by your app, but I wonder what is going on under the hood of your channel besides waiting and an occasional http request? When you say "waits" is that a sleep(10000000) or is that

while timer.gettotalseconds() < 10000000

end while


or is it

msg=wait(100000000, port)

Basically, unless your channel is duplicating screensaver functionality in some way - the screen is updated frequently, every pixel on the screen is changed at least once every 15 minutes - we want the screensaver to run, we don't want you burning in an image on someones old Plasma flatscreen.

- Joel


- Joel
0 Kudos
EnTerr
Level 8

Re: Is there a programmatic way to prevent Roku to go to scr

There are couple of ways (i can think of) that may be of help:
  1. Your code can "tickle" the player over ECP every so often to keep it awake

  2. You can include screensaver functionality in your channel, that takes precedence over the system-wide SS. Unfortunately this will be harder, since the documentation on how to do that is not available right this moment. But it has been long coming (for years) and for a while this week it was even visible.

What RokuJoel said applies, take care not to burn-in screen.
The jerk you observed is interesting - but even more interesting is when you say on 3rd request "Roku crashes and I have to restart the device". Since you say have to manually reboot Roku, it does not seem like system crash but rather error handled by BRSr. Do you see something interesting in debug console?
0 Kudos

Re: Is there a programmatic way to prevent Roku to go to scr

"RokuJoel" wrote:
That seems somewhat strange - which screensaver are you running that "jerks"? This sounds like a cpu usage issue clearly, either by the screensaver or by your app, but I wonder what is going on under the hood of your channel besides waiting and an occasional http request? When you say "waits" is that a sleep(10000000) or is that

while timer.gettotalseconds() < 10000000

end while


or is it

msg=wait(100000000, port)

Basically, unless your channel is duplicating screensaver functionality in some way - the screen is updated frequently, every pixel on the screen is changed at least once every 15 minutes - we want the screensaver to run, we don't want you burning in an image on someones old Plasma flatscreen.

- Joel


- Joel


It is:
msg = wait(1000, msgDialog.GetMessagePort())
and it loops for 300 seconds.

And yes there is some other functionality other than HTTP request. After 300 seconds roMessageDialog closes and a roScreen is shown with a full screen image (basically to show that application is trying to connect to server again and roScreen object is created at this moment and displayed). It is a one time image draw and screen is not drawn again until the HTTP request finishes. And if it is not the time to play videos then screen is closed again but if it is time to play videos then screen refreshes with a new image along with roVideoPlayer to play content.
0 Kudos

Re: Is there a programmatic way to prevent Roku to go to scr

"EnTerr" wrote:
There are couple of ways (i can think of) that may be of help:
  1. Your code can "tickle" the player over ECP every so often to keep it awake

  2. You can include screensaver functionality in your channel, that takes precedence over the system-wide SS. Unfortunately this will be harder, since the documentation on how to do that is not available right this moment. But it has been long coming (for years) and for a while this week it was even visible.

What RokuJoel said applies, take care not to burn-in screen.
The jerk you observed is interesting - but even more interesting is when you say on 3rd request "Roku crashes and I have to restart the device". Since you say have to manually reboot Roku, it does not seem like system crash but rather error handled by BRSr. Do you see something interesting in debug console?


What do you mean by tickle the player? Do you mean playing a short video in the background or just calling .Play() without any content will prevent Roku to go in screen saver mode? And how not going in screen saver mode can burn-in the screen (sorry didn't know about burn-in just googled what it is)?
0 Kudos
greubel
Level 7

Re: Is there a programmatic way to prevent Roku to go to scr

Periodically send in a keystroke via ECP BUT please be aware of screen burn in !


Sub Tickle_the_player()
eol = Chr(13)+Chr(10)
adrs = createobject( "roSocketAddress" )
adrs.setAddress( m.IPaddress+":8060" )
tcp = CreateObject( "roStreamSocket" )
tcp.setSendToAddress( adrs )
tcp.connect()
obuf = createobject( "roByteArray" )
obuf.FromAsciiString( "POST /keypress/Lit_X HTTP/1.1"+eol+eol )
z = obuf.Count()
obuf[z] = 0
tcp.send( obuf, 0, z )
End Sub
0 Kudos
EnTerr
Level 8

Re: Is there a programmatic way to prevent Roku to go to scr

"greubel" wrote:

... tcp = CreateObject( "roStreamSocket" ) ...

You Sir, are hardcore. I have respect for someone who can talk to web server over telnet. I am more wimpy and'd do:

req = createObject("roUrlTransfer")
req.setUrl("http://localhost:8060/keypress/Lit_+")
req.postFromString("")
Almost biting my knuckles for being unable to do it in one-liner. Also of note, "localhost" won't do on legacy fw3 (needs proper IP).
0 Kudos
EnTerr
Level 8

Re: Is there a programmatic way to prevent Roku to go to scr

"scorpiontahir02" wrote:
What do you mean by tickle the player? ... And how not going in screen saver mode can burn-in the screen (sorry didn't know about burn-in just googled what it is)?

By "tickle" i mean to simulate someone pressing remote button to keep it awake. Roku has this feature that allows limited remoting over network. I have read on the forum in the past it being exploited in the way suggested - the channel making a round-about network call to the player and injecting button press to keep it from falling asleep. You won't need to deeply understand the protocol for this, can just use snippets we gave.

No need to freak over screen burn-in, it's just that TV screens (CRT, plasma, OLED... actually seems all types) are prone to permanent discoloration of parts of the screen if the same image has been shown for really, really, really long time. See wiki page for examples. There is no special magic by which designated screensavers prevents burn-in, they are just written to show moving images on mostly black screen - you can do that on your own too, just don't leave same image on screen for days.

There is also the part where Roku player goes to deep sleep and turns off any video output. I don't know how that works (does anybody know?) but assume that after a screensaver has been on for long enough (=?) time, it is lights off even for the screensaver.
0 Kudos
kc8pql
Level 7

Re: Is there a programmatic way to prevent Roku to go to scr

^ Unless something's changed over the years, the video output never actually turns off as long as the box (or stick) is powered up.
There is no real sleep mode. It's just idle.
____________________________________________________________________________________________________________
No, I don't work for Roku.
Netflix Player N1000X, XDS 2100X (premature death by lightning)
Roku2 XD 3050X, Roku2 XS 3100R, Roku2 4210R
0 Kudos

Re: Is there a programmatic way to prevent Roku to go to scr

"greubel" wrote:
Periodically send in a keystroke via ECP BUT please be aware of screen burn in !



Thank you very much for the code snippet. Although I do understand a little bit socket programming, so I so understand your code a little bit too but as EnTerr's code snippet seems quite simple so I will try that first and if not successful then will use this snippet.
0 Kudos