Screenshot of roScreen

I’ve just developed my first screensaver, and am having trouble getting a screenshot. I’ve tried grabbing a shot during the preview on the “Roku Player Settings” screen, and I’ve added a Main() to run as a conventional channel. In both cases I get a shot of the Roku home screen, how it looked immediately prior to the channel launching or the settings screen showing.

screen = CreateObject(“roScreen”, False)
port = CreateObject(“roMessagePort”)
screen.SetMessagePort(port)
screen.SetAlphaEnable(True)

There’s one thread on this forum from a while back suggesting it should be possible to get screenshots from a roScreen, but unfortunately that didn’t shed any light on my problem. Any advice gratefully received.

Btw, For those who are curious, it does some fun things with news RSS feeds – I’ve posted a private channel beta version here: https://owner.roku.com/add/PostItNewsBeta ; I’m hoping to submit the full version when I’m happy with it as a free public channel. (The New York Times is a good feed to test it with, as it includes images).

Thanks in advance for any help…

Screenshots of roScreen work best for me after swapping the buffers so both the front and back buffer are the same.

As destruk mentions, screenshots with roScreen seem to be taken from the back buffer. Since you’re not using double-buffering, you may need to enable it to get a screen shot. It really shouldn’t require much to change your code. Just enable double buffering in your CreateObject call, and replace screen.Finish() with screen.SwapBuffers().

Strangely enough I could have sworn I tried the double buffer trick earlier on in development and couldn’t get it to work – but this time it did! Mind you, I was still experimenting with how all the lower level graphics stuff works, so clearly I was doing something wrong!

Thanks for all your help.


[upload

[upload|bHVmYj7CEHX/XTiT9LVuKw==]

Success!! :slightly_smiling_face:

That’s a slick looking screensaver. Nicely done!

“TheEndless” wrote:
That’s a slick looking screensaver. Nicely done!

Ditto!

C. Shawn Smith

Yes very nice, you should kill the private channel and sell it as a 0.99 cent screensaver in the channel store.

  • Joel

“RokuJoel” wrote:
Yes very nice, you should kill the private channel and sell it as a 0.99 cent screensaver in the channel store.

  • Joel

+1

C. Shawn Smith

I had the screensaver set on my box over the weekend, and found that it would, more times than not, run for awhile, then revert back to the default bouncing Roku screensaver. That’s usually an indication that it’s crashing.
Some times it would run fine for a few hours before crashing, other times it would crash after 10-15 minutes. If there’s anything you’d like me to look out for that could help you debug it, let me know.

From experience, memory management can be tricky with roScreen, so make sure you’re always checking the validity of your roBitmaps after you create them. Also, in case you’re not aware, you can telnet to port 8087 to see debug output from a sideloaded screensaver, so if it is crashing, you should be able to see the trace there, if you’re able to re-create it.

Yeah, I noticed some issues after I posted the private version (Murphy’s Law of Software: serious bugs only show up five minutes after you’ve uploaded your code!) I switched some of the fonts and began getting crashes (actual box freezing/reboots!) on a frequent basis; I’ve only been developing for the Roku since mid December, and this is the first time I’ve played with the lower level bits of the API, so that’s why I’m taking it nice and slow rather than rushing to push something to the public store.

I’ve added an explicit call to garbage collect in between each category (when the screen blanks) because I noted the docs say the Roku doesn’t do background GC’ing, and I’ve now had it running for a while without issue. Thanks for the tip on 8087; I think I need to just leave it running for a few hours with a telnet open.

On the plus side, I’ve fixed the bug where text sometimes gets clipped off of the RHS. :slightly_smiling_face:

I’ll probably push the public version (when or if it ever gets released!) up as a free channel. Maybe I’ll make the code public too, if people are interested! If it’s popular I might do a Twitter version, that tracks your chosen # and @ messages (assuming the search API is still accessible – not played with Twitter APIs for a long time!) Who knows!!! :slightly_smiling_face:

Thanks again for all your help.