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: 
Arrakis90
Channel Surfer

Clarification on private screensavers

I have an audio player channel and I would like to implement a custom (private) screensaver so that we avoid the generic system or another user-selected screensaver. I've read the docs over and over but it's just unclear where you do the work to implement the screensaver as private. 

Do I implement RunScreenSaver in my existing main, or does the whole thing have to live in a separate project? Is there some other way that it's to be done so that after idle time, my own screen is called? How does my project know to call that screensaver if it does have to be in its own separate project?

The docs and samples in the repo only show screensavers that are meant to be published publicly unless I'm misinterpreting them.

Thanks for any guidance. 

0 Kudos
5 REPLIES 5
renojim
Community Streaming Expert

Re: Clarification on private screensavers

You implement your screensaver within your project and have its entry in the RunSaverSaver function which will get called automatically after the user's set screensaver timeout period.  Add "screensaver_private=1" to your manifest.  That's pretty much it.  You can share code between it and the rest of your project, but note that the screensaver runs in its own thread and sharing information between the rest of your project and it is a little bit of a pain.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
Arrakis90
Channel Surfer

Re: Clarification on private screensavers

Thanks renojim, that got me off and running.

When it comes to sharing data, I've noticed that while I can get info by passing a temp file (per the guide here), it seems like the main channel is put to sleep, even when audio continues to play, so my song info isn't updating. I've got it set to run on a timer to recheck the temp file every 5 seconds.

This issue also appears to cause our analytics to stop when the screensaver starts. We have a heartbeat ping that runs every 5 seconds, but that stops until the screensaver is deactivated.

Is it normal that everything but audio is put to sleep during a screensaver? I was thinking that both threads continued to run.

0 Kudos
renojim
Community Streaming Expert

Re: Clarification on private screensavers

That sounds odd, but my experience with private screensavers began long before the scene graph plague and I don't think I've used one with scene graph.  I could see how the render thread may be put to sleep if the screensaver is active since there's no need to render anything.  I used to implement my own screensaver as just another function and send key presses using ECP to keep the system screensaver from invoking, but you're not allowed to do that in certified channels anymore.  I wish I knew why Roku had these arbitrary limitations.  I'd have to do some experiments, but I know in the past that the main thread continued to run when the screensaver was active.  It's not used much in SG channels other than waiting on the scene to close, but there's no reason why you can't put it to use.  You're making me want to do a test to see if an observer waited upon in the main thread fires if the screensaver is active, but you could always implement your heartbeat in the main thread using sleep or waiting for a roTimespan object to hit some value.

I'm more comfortable with polling vs. event driven programming, but I'm very old school.  🙂

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
renojim
Community Streaming Expert

Re: Clarification on private screensavers

So after some experimentation it appears the only thread that continues to run once the screensaver is active is the main thread.  The render thread and any task threads are suspended.  I don't know if this is documented anywhere.

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
Komag
Roku Guru

Re: Clarification on private screensavers

Thanks for this renojim, I'm planning to do some screensaver work for my game and this bit info will be helpful!

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.