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

Re: In-app screensaver?

"nowhereman" wrote:
"TheEndless" wrote:
I've also added a "RunScreenSaver()" method that currently simply consists of a "print" so I can see if it's being called. Eventually that will be replaced with code that draws an "roImageCanvas" with my custom screensaver content.


If RunScreenSaver() doesn't contain an event loop, it's probably just returning right away and falling out to the system screen saver. I just tried what you describe and got the same result. My print did not appear on the console and the default SS came on. Try putting up a blank canvas and implementing a simple event loop in RunScreenSaver().

Hrmmm... well, that produced different behavior, which is encouraging, but not the expected behavior. Instead of getting the default screensaver, the screen went black... my code paints it blue and puts text on it, so it's not mine. Interestingly, the wait loop on the screen that was up before the screensaver is still running, so I suspect the screensaver runs in different thread, which would explain why we don't get prints to the console. See anything obviously wrong with this code?


Sub RunScreenSaver()
print "screensaver"

background = {
Color: "#0000FF",
TargetRect: { x: 0, y: 0, w: 1280, h: 720 }
}
text = {
Text: "Screensaver",
TextAttrs: {
Color: "#FFFFFF",
Font: "Large"
},
TargetRect:{ x: 0, y: 500, w: 1280, h: 35 }
}

msgPort = CreateObject( "roMessagePort" )
screen = CreateObject( "roImageCanvas" )
screen.SetMessagePort( msgPort )
screen.SetRequireAllImagesToDraw( false )
screen.AddLayer( 1, background )
screen.AddLayer( 2, text )
screen.Show()

While true
msg = Wait( 1000, msgPort )
If msg.isRemoteKeyPressed() Then
screen.Close()
Return
End If
End While
End Sub
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
nowhereman
Visitor

Re: In-app screensaver?

"TheEndless" wrote:
See anything obviously wrong with this code?


Sub RunScreenSaver()
print "screensaver"

background = {
Color: "#0000FF",
TargetRect: { x: 0, y: 0, w: 1280, h: 720 }
}
text = {
Text: "Screensaver",
TextAttrs: {
Color: "#FFFFFF",
Font: "Large"
},
TargetRect:{ x: 0, y: 500, w: 1280, h: 35 }
}

msgPort = CreateObject( "roMessagePort" )
screen = CreateObject( "roImageCanvas" )
screen.SetMessagePort( msgPort )
screen.SetRequireAllImagesToDraw( false )
screen.AddLayer( 1, background )
screen.AddLayer( 2, text )
screen.Show()

While true
msg = Wait( 1000, msgPort )
If msg.isRemoteKeyPressed() Then
screen.Close()
Return
End If
End While
End Sub


AddLayer() is not a member of roImageCanvas. It should be SetLayer().
twitter:nowhereman
http://www.thenowhereman.com/roku
http://www.thenowhereman.com/netflix
0 Kudos
TheEndless
Channel Surfer

Re: In-app screensaver?

"nowhereman" wrote:
AddLayer() is not a member of roImageCanvas. It should be SetLayer().

Ugh... I knew that... I guess the runtime error on that one was posted to the other thread as well. 😛

That was it. Thanks for your help! I really appreciate it!

Steve
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
TheEndless
Channel Surfer

Re: In-app screensaver?

Ok.. new issue. With the screensaver, I never seem to get the IsScreenClosed() event that the Clock SDK example suggest I should. In fact, I never seem to get any events in my wait loop. In general, that's not a big deal for the screensaver, but my app seems to lose focus when the screensaver comes up, and I never get it back. I don't know if they're related or not, but I suspect it has something to do with my wait loop never exiting, because I have no way to detect when the screensaver is closed. Any ideas?
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
TheEndless
Channel Surfer

Re: In-app screensaver?

Scratch that. It seems the same thing happens when the default screensaver is used. I'll start a new thread.
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
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.