{
adpodcache: invalid
adpodcacheupdated: false
adurl: ""
clearadbufferscreenlayers: <Function: roku_ads_clearadbufferscreenlayers>
drawadbufferingprogressbar: <Function: roku_ads_drawadbufferingprogressbar>
enableadbuffermessaging: <Function: roku_ads_enableadbuffermessaging>
enablegarbagecollection: <Function: roku_ads_enablegarbagecollection>
enablenielsendar: <Function: roku_ads_enablenielsendar>
...
{
adpodcache: invalid
adpodcacheupdated: false
adurl: ""
clearadbufferscreenlayers: invalid
drawadbufferingprogressbar: invalid
enableadbuffermessaging: invalid
enablegarbagecollection: invalid
enablenielsendar: invalid
sub createAds()
m.top.ads = Roku_Ads()
end sub
<interface>
<field id="ads" type="assocarray" />
</interface>
"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.
"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.
"EnTerr" wrote:
This shows RAF used from a Task:
https://github.com/rokudev/RAF4RSG-sample
"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?
sub showChannelSGScreen()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("MainScene")
screen.show()
MakeSome() '<---- HERE
sub MakeSome()
ads = Roku_Ads()
<?xml version="1.0" encoding="UTF-8"?>
<component name="CreateAdsTask" extends="Task" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd">
<script uri="pkg:/components/CreateAdsTask.brs" />
<interface>
<field id="ads" type="assocarray" />
</interface>
</component>
Library "Roku_Ads.brs"
Sub Init()
m.top.functionName = "createAds"
End Sub
sub createAds()
m.top.ads = Roku_Ads()
end sub
m.adsTask = createObject("RoSGNode", "CreateAdsTask")
m.adsTask.observeField("ads", "setAds")
[size=85][font=Helvetica Neue, Helvetica, Arial, sans-serif] m.adsTask.control = "RUN"[/font][/size]
sub setAds()
m.ads = m.adsTask.ads
"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.