Good morning!
Okay wow it's already afternoon. Yikes~
Good afternoon!
I built myself a REAL jank-but-useful screensaver a couple years back that simply shows an image hosted at a particular URL and refreshes every 30 seconds. That's it. Specifically, it's a dynamic link that shows my and my wife's shared calendar via DAKBoard, but still - as far as the app is concerned it's just an image.
I don't think the app itself is having any issues. Here is the code from main.brs just in case I'm missing something, but this has always worked in the past:
Sub RunScreenSaver()
ShowScreenSaver()
End Sub
Sub ShowScreenSaver()
' Works With Images
' facade = CreateObject("roParagraphScreen"
' facade.Show()
' forum mentions facade call is issue
m.canvas = CreateObject("roImageCanvas")
canvas_size = m.canvas.GetCanvasRect()
m.canvas.Show()
while(true)
date = CreateObject("roDateTime")
m.canvas.SetLayer(1,{ url: "https://api.apiflash.com/v1/urltoimage?access_key=MYKEY&format=png&ttl="+(rnd(7200)+21600).toStr()+"&url=https%3A%2F%2Fdakboard.com%2Fapp%2FscreenPredefined%3MY_UID"
' + date.AsSeconds().ToStr()
CompositionMode: "Source"
TargetRect: {x:0,y:0,w:canvas_size.w,h:canvas_size.h}})
' Sleep For 30 Seconds
sleep(300000)
end while
m.canvas.Close()
End Sub
With the new beta channels and ways of signing apps, I just CANNOT get it to work. I mean - it publishes correctly in the Manage My Channels section and makes it onto my local Roku just fine, but when I attempt to launch the screensaver I get Screensaver Not Available with no more specific errors pointing me in the right direction.
Is there something simple I'm missing? An extra step with these new beta channels aside from repackaging with genkey and uploading to My Channels?
Any advice you got, I'll take - thank you!
With the new Roku software version 11.5 you can no longer use any of the components you're using (roParagraphScreen, roImageCanvas). They've been completely removed and you'll get the oh so helpful "Not available" message. It should say "Not compatible".
You need to convert either to Scene Graph or roScreen. Given how simple your screensaver is, roScreen is probably the easiest path, although if you wanted an introduction to Scene Graph it wouldn't be too difficult.
That means that if your main program or currently running channel is based on roScreen it will not be able to create a roScreen as a screensaver. This is annoying and I don't know why that is(still) an issue. I have worked around this by getting the viewers time to screensaver setting and spinning up a scenegraph instance just before the screensaver kicks in and kill the SG instance on screensaver exit... if you don't have a main program you shouldn't need to worry about it. Anyway try this.
function main()
screen=CreateObject("roScreen", true, 1280, 720)
xrl=CreateObject("roUrlTransfer")
xrl.SetUrl("https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png" )
xrl.SetCertificatesFile("common:/certs/ca-bundle.crt")'https requires this
xrl.GetToFile( "tmp:/image.png" )
fs=CreateObject("roFileSystem")
?fs.GetDirectoryListing("tmp:/")'see if the image downloaded
image=CreateObject("roBitmap", "tmp:/image.png")
screen.DrawObject(0, 0, image)
Screen.swapbuffers()
while true:end while
end function
Easier to test as a main program and when you have everything working, change function 'main' to 'runscreensaver'
With the new Roku software version 11.5 you can no longer use any of the components you're using (roParagraphScreen, roImageCanvas). They've been completely removed and you'll get the oh so helpful "Not available" message. It should say "Not compatible".
You need to convert either to Scene Graph or roScreen. Given how simple your screensaver is, roScreen is probably the easiest path, although if you wanted an introduction to Scene Graph it wouldn't be too difficult.
It's you! 😮
**bleep** - as much of a whole thing as it is going to be to "learn something new" <shudder>, I really appreciate the response. That error message was sending me waaaay down the wrong path. Thanks for pointing me to the right function, though! Time to waste a bunch of time!
@Fourhundred57 wrote:It's you! 😮
Yeah, unfortunately I'm about the only one that seems to try to help anyone here.
Converting to roScreen should be fairly straightforward. If you have any questions, feel free to ask. I'm a lot more comfortable with roScreen than Scene Graph. 🤢
Well, I really appreciate it. I'm physically in the office today for no real reason aside from "you need to be here sometimes" - so it's a perfect time to learn new Roku stuff! Before I dive into roScreen vs Scene Graph documentation, I have one question: Is there a way with either method to bypass the UI resolution limit? It's strange to me that my device can pump out 4k video without an issue but is unable to show a static 4k image as a screensaver.
I don't think there's any way to create a screen that's bigger than FHD (1920x1080), but I could have sworn I saw a mention of QHD resolution and Scene Graph somewhere, but I can't find it now. I tried to create an roScreen of 3840x2160 and my Ultra just crashed.
"Yeah, unfortunately I'm about the only one that seems to try to help anyone here."
RenoJim, I just came across this doing a search on an old topic from like years ago, the RokuDevelopers .Slack.Com channel is very active, and seems to be where a lot of people went. The drawback (a major one) is that it is an unpaid channel, so everything ages off after 90 days. I had noticed yourself, Komag, Enterr, and others were absent, but assumed you all went on to other things, never thought of looking back here.
@sjb64, I looked into the Slack channel when it first started and there was something about it I didn't like or maybe I just didn't see the point of moving everyone from here. I didn't know about the aging off thing, but that's just one more reason to wonder, what's the point?
Enterr became RokuNB and as far as I can tell it must be Roku policy to not have any of their employees participate here no matter how chatty they used to be. I think Komag still shows up once in a while.
Hey @renojim! I hate dragging you back into this, but I think I have something that isn't using deprecated objects now (as I'm no longer getting that confusing 'Not Available' message) -- but when I load the below code I'm getting a pure black screen.
At this point, I think I'm just wanting confirmation that this is related to the actual code rather than some weird issue with appearing to successfully sideload a .zip file but it somehow getting rejected elsewhere.
Sub RunScreenSaver()
screen = CreateObject("roScreen")
image = CreateObject("roBitmap")
while(true)
image.SetUrl("https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png")
screen.SetContent(image)
screen.Show()
sleep(300000)
end while
Screen.Finish()
End Sub
'roBitmap' does not have any interfaces, so you cannot load an image that way.
'roScreen' does not have the interfaces 'setContent()' or '.show()'
You will need to create a urlTranser to download the image and save it to temp:/
https://developer.roku.com/docs/references/brightscript/interfaces/ifurltransfer.md
xrl=CreateObject("roUrlTransfer")
xrl.SetUrl( url ) 'the url you are requesting
xrl.GetToFile( "tmp:/image.png" )'where the image is to be stored
create a 'roBitmap' with that image
https://developer.roku.com/docs/references/brightscript/components/robitmap.md
image=CreateObject("roBitmap", "tmp:/image.png")
and draw it to the screen
screen.DrawObject(0, 0, image)
Screen.Finish()
https://developer.roku.com/docs/references/brightscript/interfaces/ifdraw2d.md
You can also look at the samples for Roku screensavers, These are Scenegraph examples but might help with what you are doing.
https://developer.roku.com/docs/developer-program/media-playback/screensavers.md