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: 
brybott
Level 8

Roku Ad Framework and Scene Graph apps

Is it possible to utilize Roku Ad Framework in a Scene Graph app?

To utilize RAF, you have to call:
Library "Roku_Ads.brs"

in the main thread. How will the Scene Graph thread get that info when it's time for an ad to be displayed?
0 Kudos
3 Replies
TheEndless
Level 7

Re: Roku Ad Framework and Scene Graph apps

Don't quote me on this, but I believe the way to do that would be to add a custom interface field to your scene, then register the main Brightscript thread as an observer on the field. Then, in your event loop, you'd listen for an roSGNodeEvent that indicates that field has been updated, and trigger the playback. You'd likely want a second status field as well, so you can pass whether viewing the ad was successful or not back to the SceneGraph thread.

Seems very hacky, but I don't know of any other way to accomplish it with the current RAF library. Hopefully they're working on a native SceneGraph version.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: Roku Ad Framework and Scene Graph apps

TheEndless is correct. All Roku Ad Framework logic will reside in the main thread where you're instantiating your main scene. Within the main thread you'll utilize observefield("field_name", port) to receive roSGNodeEvents to trigger adIface.getAds() then pass back the received ad pods to a node within your scene. From here you can marshall the adpods to your Video node for playback
--
Float Left Interactive Team
www.floatleftinteractive.com
0 Kudos
brybott
Level 8

Re: Roku Ad Framework and Scene Graph apps

Thank you both for your answers, it definitely helps shed some light on the subject. I'll follow up with another question in another thread since it is a bit more general.
0 Kudos