I don’t know if this is an isolated problem, or if I’m just crazy, but I ran into a very strange issue today while developing a scene.
I have a scene that is structured like all my others that work just fine. I have my brightscript code embedded into the xml file itself rather than splitting them up. I added some functions for handling button logic to the scene, packaged it up, and deployed it to my local Roku player.
The debugger shows the normal:
------ Compiling dev 'channelname' ------
Once that displays in the debugger there’s no other output and the player freezes and doesn’t accept remote input, doesn’t respond to external control commands; the splash screen for the channel doesn’t even display. When I restart the player the Roku logo appears then goes into a black screen. I let it sit for 30 minutes a couple times but the main menu failed to load. I had to do a factory reset to get the player to boot properly again.
After some debugging I narrowed the problem down to the name of one of my button handler functions:
onSubmitButtonSelected
If I change the name of the function the channel runs fine. I thought maybe I had another function somewhere with the same name and that caused some kind of collision during compilation, but I don’t.
Anyone have ideas what was happening here? Is there a global built-in function named onSubmitButtonSelected? I tried to see if that was the case but couldn’t find any answers.
For the record, can you give model# and firmware#?
Ha! Am i getting this right - you are saying that changing onSubmitButtonSelected to onSubmitButtonSelected1 fixes the problem - and changing it back makes it disappear?
(Best if you can do this as clean room experiment, i.e. repeating above - change only the name to literally onSubmitButtonSelected1 and try, then literally change only to onSubmitButtonSelected and try)
A reserved word would have caused syntax error, where a global function would’ve silently overridden yours.
Both players had the same model/firmware:
Model: 4230X - Roku 3
Firmware: version 7.1.0 build 4061-04
I performed the test you proposed and saw the behavior I had been seeing all day: onSubmitButtonSelected caused a freeze/crash, onSubmitButtonSelected1 launched just fine.
Wow, that seems like a splendiferous bug to discover! :twisted:
Considering you report it leaving the player dead beyond reboot - and in need of factory reset.
Can you assemble a minimal example, say something you can post as [ code] … [/code] here - i can try it on my player too. There is better chance for Roku* to pay attention if the issue is confirmed by a 3rd party
It would be helpful to see the original sample. I just created the sample below with no issues:
SimpleButtonScene.xml
<?xml version="1.0" encoding="utf-8" ?>
SimpleButtonScene.brs
'********** Copyright 2016 Roku Corp. All Rights Reserved. **********
function init()
m.button= m.top.findNode("button")
m.button1 = m.top.findNode("button1")
m.button.ObserveField("buttonSelected", "onButtonSelected")
m.button1.ObserveField("buttonSelected", "onSubmitButtonSelected")
m.button.SetFocus(true)
m.label = m.top.FindNode("myLabel")
end function
function onButtonSelected() as void
m.label.text = "Button Pressed"
end function
function onSubmitButtonSelected() as void
m.label.text = "Button1 Pressed"
end function
function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
if press then
if (key = "down") then
if (m.button.hasFocus())
m.button1.setFocus(true)
else
m.button.setFocus(true)
end if
handled = true
else if (key = "up")
if (m.button1.hasFocus())
m.button.setFocus(true)
else
m.button1.setFocus(true)
end if
handled = true
end if
end if
return handled
end function
I’m seeing this same behavior, though I haven’t been able to narrow down to a single function name. I don’t have a “onSubmitButtonSelected” function, but i have some interfaces with xxxButtonSelected fields. Hopefully I can narrow this down but it’s a very long debug cycle having to reset my Roku 4 each time.