Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
retrotom
Level 7

Roku Ad Framework doesn't load when using dynamic scripts

We've been using the "Run" global function to dynamically insert/modify behavior with our app. When using this core feature with the RAF client library, it fails to compile and run the script because of a failed Library inclusion. After lots of digging around -- it appears that the RAF client library is not really a "file". It doesn't live in the usual places (common://, tmp://) and when you get a backtrace you see that it's in roku_ads_lib:// -- but that doesn't appear to be "real". I can't copy the library file, move my script, or compose a directory structure that has successfully included the RAF client library. Can I get some help on this? Is this still possible or should we look for other solutions?
0 Kudos
11 Replies
EnTerr
Level 8

Re: Roku Ad Framework doesn't load when using dynamic script

Preface: for legal purposes this is a speculation, there has been no official statement by the Co. But you know, "sapienti sat" Smiley Wink

RokuCo is hiding the RAF library intentionally. They don't want you to be able to see the source, what and how it does (ostensibly spying on your 3rd party ads). They have gone to lengths doing that, like hiding from us the "roku_ads_lib:" mount and wiping source line information (now shown as "???").

In their defense, it's not illegal or unusual to consider library a "trade secret".
In their offense, RAF has history of crapping out.
And to add injury to the insult, the use of RAF is now mandatory.

Great job cyber-sleuthing, btw @retrotom!
0 Kudos
Roku Employee
Roku Employee

Re: Roku Ad Framework doesn't load when using dynamic script

Hi, we consider Run() and Eval() to be deprecated methods and we do not encourage nor support nor recommend the use of those methods in your channels.

- Joel
0 Kudos
EnTerr
Level 8

Re: Roku Ad Framework doesn't load when using dynamic script

"RokuJoel" wrote:
Hi, we consider Run() and Eval() to be deprecated methods and we do not encourage nor support nor recommend the use of those methods in your channels.

What would you recommend we do instead, to protect from RAF soiling itself like in
viewtopic.php?f=34&t=95525#p534724 ?!

Crash in RAF causes crash of the app, if not sandboxed. If i understood well, RAF's "interactive ads" now bomb on fw 7.0 or earlier - and there got to be how many of these in the wild, like 1 million? (glancing in the general direction of RokuTV brand galore and OTT licensees)
0 Kudos
Roku Employee
Roku Employee

Re: Roku Ad Framework doesn't load when using dynamic script

"EnTerr" wrote:

Crash in RAF causes crash of the app, if not sandboxed. If i understood well, RAF's "interactive ads" now bomb on fw 7.0 or earlier - and there got to be how many of these in the wild, like 1 million? (glancing in the general direction of RokuTV brand galore and OTT licensees)


A fix for the RAF issue on FW 7.0 or earlier has been deployed already (recently).
0 Kudos
retrotom
Level 7

Re: Roku Ad Framework doesn't load when using dynamic script

"RokuJoel" wrote:
Hi, we consider Run() and Eval() to be deprecated methods and we do not encourage nor support nor recommend the use of those methods in your channels.

- Joel


I'm not sure this is an appropriate response. The code used to work perfectly fine before a mandatory client library "upgrade". There are/used to be several mentions of using these methods for dynamic logic in apps. We use it as a mechanism for improved exception handling; the only way to restart/re-initialize your application in the cause of an unforeseen error. While I recognize and understand the want/need to standardize the ad client library implementation for your device -- saying that it doesn't work with a particular long-standing use case is not "deprecation". It's a gap in implementation. Whatever flow spawns the context for "Run()" doesn't account for library inclusion appropriately -- it's as simple as that. Please fix that.
0 Kudos
EnTerr
Level 8

Re: Roku Ad Framework doesn't load when using dynamic script

@retroTom -
can you give a more detailed example of what you are doing and what is happening/error-ing?

Maybe there would been less of a generic brush-off if you had shown specifics.
If you can stub and post a minimal example, plus the errors - maybe others can come with ideas, if not Roku*.

PS. is "scenography" involved in some way? Because script inclusion there seems to be a mess-o-potamia
0 Kudos
retrotom
Level 7

Re: Roku Ad Framework doesn't load when using dynamic script

Placing these code snippets into a file and using Run() exhibits the following behavior:


Library "Roku_Ads.brs"
Library "v30/bslDefender.brs"

Function Main(args)
print "Hello World!"
End Function


Fails to compile/run anything. The error code indicates that a file is not found at first line. Meaning the BrightScript compiler can't find Roku_Ads.brs.


Library "v30/bslDefender.brs"

Function Main(args)
print "Hello World!"
End Function


Runs just fine. Meaning the BrightScript compiler can find v30/bslDefender.brs and execute the script without any issues.
0 Kudos
retrotom
Level 7

Re: Roku Ad Framework doesn't load when using dynamic script

The above indicate the issue and how to replicate it. I've tried to work around it in various ways. For instance, the Run() method can be passed arguments in the form of associative arrays. Unfortunately, whatever you pass via this method appears to be serialized and deserialized for the script you launch. The script runs in a completely different context. So you can't pass functions -- which was the first thing I tried to try and fix it. I figured that if I could shim or pass the client library that would meet my needs. No Dice.

I tried to create a fake application structure. That is, include a manifest with the proper "includes" and place my script in a "source" folder. My thinking here was that when creating a new context for the script, it was looking for a manifest potentially, not finding it, and therefore not including the RAF client library. Tried that -- didn't work.

I tried to see I could read/move/copy the client library from the roku_ad_lib:// mount. That didn't work. Appears to be a virtual mount because no roFileSystem methods work with it.
0 Kudos
EnTerr
Level 8

Re: Roku Ad Framework doesn't load when using dynamic script

I see. You have checked already some of what i was thinking.
Please don't shoot me for the crazy question - but did you check if Roku_Ads() is available in the Run() w/o using the Library statement? (probably not but worth trying)

"retrotom" wrote:
I tried to see I could read/move/copy the client library from the roku_ad_lib:// mount. That didn't work. Appears to be a virtual mount because no roFileSystem methods work with it.

Right, It does not show in getVolumeList() nor works with getDirectoryListing(), i know. Methinks 'tis not coincidence Smiley Happy
0 Kudos