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: 
destruk
Binge Watcher

Splashscreen with Roku1?

From RokuJoel --


di=createobject("roDeviceInfo")
canvas=CreateObject("roImageCanvas")
canvas.SetLayer(0, { color: "#000000" })
If di.GetDisplayType()="HDTV"
canvas.SetLayer(1, [{
url: "pkg:/images/splashhd.jpg"
targetRect: {
x: 0
y: 0
w: 1280
h: 720
}
}])
Else
canvas.SetLayer(1, [{
url: "pkg:/images/splashsd.jpg"
targetRect: {
x: 0
y: 0
w: 720
h: 480
}
}])
End If
canvas.Show()


Place that in your main function, or the first one your channel runs.
0 Kudos
6 REPLIES 6
RokuJoel
Binge Watcher

Re: Splashscreen with Roku1?

"destruk" wrote:
From RokuJoel --


code copied by RokuJoel, created by RokuChris 🙂

- Joel
0 Kudos
destruk
Binge Watcher

Re: Splashscreen with Roku1?

Thanks RokuChris and RokuJoel ! 🙂
0 Kudos
greubel
Visitor

Re: Splashscreen with Roku1?

How do you detect that you need to display it ?
Roku level 3 or less than 4 ?
0 Kudos
RokuJoel
Binge Watcher

Re: Splashscreen with Roku1?

Best bet would be to use it on all platforms, no need to detect. If you must detect version, use rodeviceinfo:

function IsNotLegacyDevice() as boolean
version = CreateObject("roDeviceInfo").GetVersion()
major = Mid(version, 3, 1)
minor = Mid(version, 5, 2)
build = Mid(version, 8, 5)

if major.toint() >= 4 then
return true
else
return false
end if
end function



- Joel
0 Kudos
greubel
Visitor

Re: Splashscreen with Roku1?

I must have missed something ????

I created a subroutine called from the main with a combination of the above snippets, displayed the splash screen with a 1 sec wait. Looked good.
Then returned and the program closed ???? ( screen fell off the stack )
Now the funny thing is, it didn't close right away. Got through several subroutines before it died. And appears to die in different spots.

Changed the subroutine to return the screen object and had the main caller keep an instance. Now it works !!!
Changed the subroutine to close() the screen object and it fails !

Where is it written that if you display a screen, close it and it was the only one, that it implies "PROGRAM END" ????
Maybe the program had something else to do ! In this case, the entire program.

Now to have this work, I have to keep the splash screen object laying around.
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Splashscreen with Roku1?

It has always been true that a channel exits when you close all of its screens and there has been a fair bit of discussion about it here over the years.

viewtopic.php?f=34&t=50590&start=0
http://sdkdocs.roku.com/display/sdkdoc/ ... th+Screens
http://sdkdocs.roku.com/display/sdkdoc/ ... kuPlatform
0 Kudos