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.
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.
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.
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. 🙂
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.
Thanks for this renojim, I'm planning to do some screensaver work for my game and this bit info will be helpful!