Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
brybott
Visitor

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 3
TheEndless
Channel Surfer

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
Visitor

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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.