If I run the following code to display a default springboard screen and the only thing I do after entering the channel is press the Home key on my Roku remote, then my Roku reboots:
sub main ()
port = CreateObject ("roMessagePort")
screen = CreateObject ("roSpringboardScreen")
screen.SetMessagePort (port)
screen.SetContent ({ContentType: "episode"})
screen.Show ()
for each msg in port
print "Message received"
end for
end sub
However, if I run the following code replacing the for-each loop with a while loop, then when I press the Home key the channel correctly exits:
sub main ()
port = CreateObject ("roMessagePort")
screen = CreateObject ("roSpringboardScreen")
screen.SetMessagePort (port)
screen.SetContent ({ContentType: "episode"})
screen.Show ()
while true
msg = wait (0, port)
print "Message received"
end while
end sub
According to the BrightScript reference manual, section 4.7 Events, on page 20, these two statements should be equivalent.
Any idea why the first one would crash the Roku? I'm running the 3.0 build 2227 firmware on a Roku HD model 2000C.