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
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.)
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:
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