asenthil
15 years agoVisitor
Videoplayer fails with Welcome and Registration screens
Hi Guys,
I am building an application based on the Videoplayer example. As a part of this application, I need to have a Welcome screen and a Registration Screen. So I added two function calls in the Main function of appMain.brs like this:
Please find the function definitions below.
The registration screen should show as if the code is being fetched from the web server. Thats why, the 10s delay! Now, the problem here is when I run the application the Welcome screen appears and when I press the next button, the registration screen flashes and the application terminates and returns to the Main roku screen. I was wondering if anyone else is facing this problem or is it something in my code? I would really appreciate any comments on this and sorry for the long post!
I am building an application based on the Videoplayer example. As a part of this application, I need to have a Welcome screen and a Registration Screen. So I added two function calls in the Main function of appMain.brs like this:
Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
'prepare the screen for display and get ready to begin
screen=preShowHomeScreen("", "")
if screen=invalid then
print "unexpected error in preShowHomeScreen"
return
end if
showWelcomeScreen()
showRegScreen()
'set to go, time to get started
showHomeScreen(screen)
End Sub
Please find the function definitions below.
Function showWelcomeScreen() As Void
port = CreateObject("roMessagePort")
screen = CreateObject("roParagraphScreen")
screen.SetMessagePort(port)
screen.AddHeaderText("XYZ Channel")
screen.AddParagraph("blah")
screen.AddParagraph("blah blah")
screen.AddButton(1, "next")
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roParagraphScreenEvent" then
if msg.isButtonPressed() then
exit while
end if
end if
end while
screen.Close()
End Function
Function showRegScreen() As Void
port = CreateObject("roMessagePort")
screen = CreateObject("roCodeRegistrationScreen")
screen.SetMessagePort(port)
screen.AddParagraph("blah")
screen.AddFocalText(" ", "spacing-dense")
screen.AddFocalText("From your computer,", "spacing-dense")
screen.AddFocalText("go to www.xyz.com/roku", "spacing-dense")
screen.AddFocalText("and enter this code:", "spacing-dense")
screen.AddFocalText(" ", "spacing-dense")
screen.SetRegistrationCode("retrieving code..")
screen.AddParagraph("This screen will automatically update once your Roku player has been linked.")
screen.AddButton(0, "get a new code")
screen.AddButton(1, "back")
screen.Show()
sleep(10000)
screen.SetRegistrationCode("ABC7TG")
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roCodeRegistrationScreenEvent" then
exit while
end if
end while
screen.Close()
End Function
The registration screen should show as if the code is being fetched from the web server. Thats why, the 10s delay! Now, the problem here is when I run the application the Welcome screen appears and when I press the next button, the registration screen flashes and the application terminates and returns to the Main roku screen. I was wondering if anyone else is facing this problem or is it something in my code? I would really appreciate any comments on this and sorry for the long post!