NOTE: This was originally part of the
viewtopic.php?f=34&t=25097 thread, but I moved it separate.
I am on v2.4 - build 357
I have found a reliably reproducible crash and data corruption bug. The code below reliably crashes my Roku. I see the "Enabling HTTP Authentication" message in the debug console, then "connection closed by foreign host" as it dies. After it reboots, my wireless network settings are gone. The WPA2 key is still there, but its not connected to the Wireless Network, like that setting became corrupted. This seems bad. I had copied the videoplayer example, this code is from appVideoScreen.brs. I added the Authentication section based on the workaround in the thread above. I added a few "print" statements between each line, and it seems to crash on the "createObject("roByteArray")" *AFTER* screen.Show(). I have no idea why they have a screen.Show() above the screen.setContent(espisode), but commenting that first screen.Show() out seems to have resolved the problem.
relevant code:
screen = CreateObject("roVideoScreen")
' THIS LINE APPEARS TO BE THE CAUSE
screen.SetMessagePort(port)
screen.Show()
' Authentication
'if (episode.useAuth) then
if (true) ' Force Auth for now.
print "showVideoScreen: Enabling HTTP Authentication"
'BROKEN: screen.SetUserAndPassword(userName, userPassword)
' WORKAROUND from forums (also found it in the component reference)
' THIS LINE CAUSES THE CRASH/REBOOT and DATA CORRUPTION.
ba = createObject("roByteArray")
ba.FromAsciiString((userName + ":" + userPassword))
screen.AddHeader("Authorization", "Basic" + ba.ToBase64String())
endif
' END Authentication
screen.SetContent(episode)
screen.Show()
Tommy