That’s very interesting. Can you please tell me all places where you invoke Roku_Ads()? And where is the first place you call it? Is it possible you do that in the render thread?
Don’t assign it to m.top.ads. Assign it to the internal ‘m’, as in m.ads. Assigning the AA to a node field does the thread-safe filtering of functions you see here. Also, I think instantiating RAF in a task is only supported as of 2.0, so be sure that is the version you see reported on the console.
“Veeta” wrote:
Don’t assign it to m.top.ads. Assign it to the internal ‘m’, as in m.ads. Assigning the AA to a node field does the thread-safe filtering of functions you see here.
Great catch, Veeta!
And a most amusing, ummm behavior.
Btw, one does not need really to persist the Roku_Ads() result. Calling it repeatedly is “cheap” so just assign it in local variable (e.g. ads and not m.ads) every time needed.
Also, I think instantiating RAF in a task is only supported as of 2.0, so be sure that is the version you see reported on the console.
Yes, that is the new feature of 2.0 i hear about - plus passing the RSG Node as a 3rd parameter (view) where you want the ads to temporarily hang their UI. I believe 2.0 is already on all Roku players already though (well maybe except Sky), being separate from the firmware update schedule.
“Veeta” wrote:
Don’t assign it to m.top.ads. Assign it to the internal ‘m’, as in m.ads. Assigning the AA to a node field does the thread-safe filtering of functions you see here. Also, I think instantiating RAF in a task is only supported as of 2.0, so be sure that is the version you see reported on the console.
I don’t understand, how to do this. m here is a task, and I think to assign Roku_Ads instance to the field. m.top.ads in a field. If I assign it to m.ads, the ‘observeField’ will not work.
And yes, RAF version is 2.0.
“EnTerr” wrote:
This shows RAF used from a Task: https://github.com/rokudev/RAF4RSG-sample
That’s interesting, thank you. But I can’t define main difference (with my code) yet. Will looking more…
“EnTerr” wrote:
That’s very interesting. Can you please tell me all places where you invoke Roku_Ads()? And where is the first place you call it? Is it possible you do that in the render thread?
1st place (successfully):
main.brs:
sub showChannelSGScreen()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("MainScene")
screen.show()
MakeSome() '<---- HERE
Where MakeSome() stored in athother file, same filder, name mixin.brs:
“EnTerr” wrote:
Btw, one does not need really to persist the Roku_Ads() result. Calling it repeatedly is “cheap” so just assign it in local variable (e.g. ads and not m.ads) every time needed.
Really? Sounds good.
But, i think to separate it to the Task will be useful to share it between different Scenes and Players.
“EnTerr” wrote:
Btw, one does not need really to persist the Roku_Ads() result. Calling it repeatedly is “cheap” so just assign it in local variable (e.g. ads and not m.ads) every time needed.
I try to create Roku-Ads()in the Scene,init(), and got this error:
BRIGHTSCRIPT: ERROR: roAppInfo: class PLUGIN|MARKUP on thread RENDER: roku_ads_lib:/Roku_Ads.brs(560)
BRIGHTSCRIPT: ERROR: roMessagePort: Trying to construct a message port on a non-plugin thread: roku_ads_lib:/Roku_Ads.brs(335)
BRIGHTSCRIPT: ERROR: roUrlTransfer: class PLUGIN|MARKUP on thread RENDER: roku_ads_lib:/Roku_Ads.brs(336)
So, to create Roku_Ads() ‘any time’ is not so easy
“EnTerr” wrote:
Btw, one does not need really to persist the Roku_Ads() result. Calling it repeatedly is “cheap” so just assign it in local variable (e.g. ads and not m.ads) every time needed.
Really? Sounds good.
But, i think to separate it to the Task will be useful to share it between different Scenes and Players.
That is already done internally, it is being shared every time you call Roku_Ads(). I.e. RAF is already smart and does not create new instances on each invocation. To throw a buzzword, do you know the “signleton pattern”? RAF is a singleton already.
“mape” wrote:
That is already done internally, it is being shared every time you call Roku_Ads(). I.e. RAF is already smart and does not create new instances on each invocation. To throw a buzzword, do you know the “signleton pattern”? RAF is a singleton already.
Got it, thank you.