Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
uarlive
Level 7

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

hello. i am trying to use this code in my app main file using the video player example.

i modified it to match the functions i am using and get this error. the screen loads the image and immediately goes to the home screen. it doesnt have the 3-5 sec pause. thanks.

Sub RunUserInterface()
deviceInfo = CreateObject( "roDeviceInfo" )
displaySize = deviceInfo.GetDisplaySize()
background = {
Color: "#FFFFFF"
}
loadingImage = {
Url: "pkg:/images/MainMenu_Icon_CenterFocus_HD.png"
TargetRect: {
x: Int( displaySize.w / 2 ) - Int( 336 / 2 ),
y: Int( displaySize.h / 2 ) - Int( 209 / 2 ),
w: 365,
h: 110
}
}
loadingText = {
Text: "Loading...",
TextAttrs: {
Font: "Large",
VAlign: "Bottom"
Color: "#000000"
},
TargetRect: {
x: loadingImage.TargetRect.x,
y: loadingImage.TargetRect.y + 225,
w: loadingImage.TargetRect.w,
h: 30
}
}
canvas = CreateObject( "roImageCanvas" )
canvas.SetLayer( 0, [ background, loadingImage, loadingText ] )
canvas.Show()



Main()


End Sub
0 Kudos
TheEndless
Level 10

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

"uarlive" wrote:
the screen loads the image and immediately goes to the home screen. it doesnt have the 3-5 sec pause.

If you want it to display for a few seconds, then you'll need to add a sleep. In my channel, there is background processing going on, but if you don't have that, then you'll need an artificial pause.
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

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

try something like this:

opening_timer.Mark()
While true
msg = Wait( 1000, msgPort )
print "the seconds are: "; opening_timer.TotalSeconds()
timer = opening_timer.TotalSeconds()
if timer = 2 then
Main()
exit while
end if
end while
End sub

Its more of a timer but works if you got anything going in the background. I am sure it can be even written different i didn't test it, not in front of my work PC to see what we use exactly... test it out and let us know
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
TheEndless
Level 10

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

"dynamitemedia" wrote:
try something like this:

opening_timer.Mark()
While true
msg = Wait( 1000, msgPort )
print "the seconds are: "; opening_timer.TotalSeconds()
timer = opening_timer.TotalSeconds()
if timer = 2 then
Main()
exit while
end if
end while
End sub

Its more of a timer but works if you got anything going in the background. I am sure it can be even written different i didn't test it, not in front of my work PC to see what we use exactly... test it out and let us know

Unless you have some asynchronous processing going on, the same can be accomplished with a Sleep(2000)... That code will also lock up indefinitely if anything causes it to wait longer than a second (should be >= 2).
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

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

I mentioned i was not in front of a PC to test, didn't say it was 100% correct and to try it.

I also said i am doing something in the background thus i do not do use a sleep, and was giving him a way to do a artificial sleep.

I would also like to know how this could lock something up at a opening of a channel? is it something we need to change? cause it has never gave me a bit of problems.
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
TheEndless
Level 10

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

"dynamitemedia" wrote:
I would also like to know how this could lock something up at a opening of a channel? is it something we need to change? cause it has never gave me a bit of problems.

Assuming you're actually listening for something in that loop (or even if there's something to cause a hiccup in the wait), it could cause enough of a delay that TotalSeconds skips to 3. Checking for "= 2" would cause it to hang forever if that condition is missed, so you should use ">= 2". Even then, though, if you are actually listening for something, bailing after 2 seconds seems like it would likely cause problems if what you're listening for takes longer than that to complete.
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
uarlive
Level 7

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

thanks. i wound up using the sleep(3500).
0 Kudos
fyb3roptik
Level 9

Re: Channel "Loading" screen - as seen in PodTV and Koldcast

Can someone get this up on github please?
0 Kudos