Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ssaguiar
Streaming Star

Roku channel crashes and loose registry data - EXIT_SYSTEM_KILL

I am working in a channel which depends on internet connection to receive hls streams.

When logged to it the first time (client authenticate), it saves 2 parameters on registry.

Next time we open the channel, we check these parameters and, if they are present in the registry, it means that the client has been authenticated before so we open the video stream.

If these parameters are not present in the registry, we open a login screen.

So far, so good.

The problem: if you turn off the Roku device (remove power) and after some time reconnect it and call the channel, if the registry has the parameters and you start the player and the internet connection is not present, the system will crash after some time. It it crashes, it will crash with the exit system kill message ("lastExitOrTerminationReason":"EXIT_SYSTEM_KILL").

When this happens (for any reason), the registry is cleared and it's contents will be invalid, so the channel will ask again for the login.

Any chance to avoid this? Is there any way to test internet connection at the start of the channel (in main.brs)?

Thanks for any help

 

0 Kudos
3 REPLIES 3
jcgeorge
Channel Surfer

Re: Roku channel crashes and loose registry data - EXIT_SYSTEM_KILL


Is there any way to test internet connection at the start of the channel (in main.brs)?

You can use roDeviceInfo methods for this:

And then in your main loop, you can listen to roDeviceInfoEvents which will notify you when connection status changes. You can then handle it as you see fit in your code (pause video playback? show users a popup telling them to check connection? etc.)

ssaguiar
Streaming Star

Re: Roku channel crashes and loose registry data - EXIT_SYSTEM_KILL

Thank you for your answer. I will study it.

I have implemented a network status using the code I have found at:

https://stackoverflow.com/questions/56127302/how-to-check-for-network-connection-in-brightscript

In main.brs:

m.screen = CreateObject("roSGScreen") 'Create Screen object
m.port = CreateObject("roMessagePort") 'Create Message port
m.screen.setMessagePort(m.port) 'Set message port to listen to screen

m.deviceInfo = CreateObject("roDeviceInfo")
m.deviceInfo.setMessagePort(m.port)
m.deviceInfo.EnableLinkStatusEvent(true)
 
then, in the same main.brs:
 
m.scene = m.screen.CreateScene("PlayerScene")
m.scene.offline = not m.deviceInfo.GetLinkStatus()
m.screen.Show()
 
And, in the PlayerScene.xml:
<interface>
<field
id="offline"
type="boolean"
value="false"
alwaysNotify="true"
onChange="onOfflineChanged"
/>
</interface>
 
and, in PlayerScene.brs:
function onOfflineChanged()
if(m.top.offline)

if(m.Video <> invalid) then
m.Video.control = "stop"
m.Video = invalid
end if

print "PlayerScene -> We are offline."
showInfoPannel("Sem conexão com a internet. Se o problema persistir, tente novamente mais tarde.")
else
print "PlayerScene -> We are online."
end if
end function
 

It seems to work fine. Still have to test when the internet is not present when calling the channel or when the channel is playing.

Am I right?

 

Thank you

0 Kudos
ssaguiar
Streaming Star

Re: Roku channel crashes and loose registry data - EXIT_SYSTEM_KILL

 
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.