Hi to all
I wish to know if somebody can answer one question, which seems simple but I am not getting to work fine.
I am working in a channel project for a iptv provider.
There are 2 scenes (screen), one of them is the login screen (which will be remake to use Roku Pay) and, when the user has logged in, he will be shown the player screen.
After that, when the user open the channel, if already registered (logged in), he will be presented to the player scene (screen).
Ok, now the bad part:
If the user is logged out (using a remote command - thru the server admin or by another app (Android or IOS), then he will be logged out in the Roku channel and will be presented to the login screen gain.
If he logs in again the channels will not play.
This is caused by the fact that the channel’s scenes are being added (the login scene will have 2 instances and the player scene will also have 2 instances working).
the code I use to instantiate the scenes is:
In main.brs:
if((regDeviceid = invalid) or (regToken = invalid)) then
m.scene = m.screen.CreateScene(“LoginScene”)
m.scene.signalBeacon(“AppDialogInitiate”)
m.screen.show()
else
m.scene = m.screen.CreateScene(“HomeScene”)
m.scene.signalBeacon(“AppDialogInitiate”)
m.screen.show()
end if
In the LoginScene.brs:
m.screen = CreateObject(“roSGScreen”) 'Create Screen object
m.scene = m.screen.CreateScene(“HomeScene”)
m.screen.show()
m.top.signalBeacon(“AppDialogComplete”)
and, in the HomeScene.brs (player):
’ call a task for this:
m.screen = CreateObject(“roSGScreen”) 'Create Screen object
m.screen.CreateScene(“LoginScene”)
m.screen.show()
As you can see, I create a new screen (roSGScreen) on every call to transfer to the other scene (wich causes te scene to remain in memory).
I tried to create a global screen (roSGScreen) in main.brs and refer to it in the scenes but it didn’t work.
I searched in iternet and found some (few) materials, stating that we must use Screens Back Stack using array, as in:
https://roku.home.blog/2019/01/02/back-stack-management-in-roku-using-scenegraph-component/
There is also an example, in Roku’s examples which uses stack:
scenegraph-master-sample-master/DetailsScreen
I ask: is this the way to go? If so, where can I find some examples and tutorial (which are very rare in Roku)?
I really thanks you for any clue about this matter.
Thanks
