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: 
uxicorp
Level 7

Simplest possible way to integrate Roku- sourced ad feed?

The documentation is fuzzy on this. Is this the right way?

bs_libs_required=roku_ads_lib goes in manifest

Library "Roku_Ads.brs" - where does this go? Main? If so, where in Main?
adIface = Roku_Ads() - where does this go? Main? If so, where in Main?

The getting started doc says that's all we need to get started. I just want a single preroll ad on each video whenever the video plays. Will doing the above achieve this?
0 Kudos
6 Replies
EnTerr
Level 8

Re: Simplest possible way to integrate Roku- sourced ad feed

To quote Komag, "welcome to Roku world!" Smiley Happy. Yes, documentation is fuzzy on many things but you are almost there. Here:
    ok = false
RAF = Roku_Ads()
if RAF <> invalid:
' RAF.setAdUrl(ad_url) 'use if assigned custom URL
pods = RAF.getAds()
ok = RAF.showAds(pods)
end if
0 Kudos
uxicorp
Level 7

Re: Simplest possible way to integrate Roku- sourced ad feed

"EnTerr" wrote:
To quote Komag, "welcome to Roku world!" Smiley Happy. Yes, documentation is fuzzy on many things but you are almost there. Here:
    ok = false
RAF = Roku_Ads()
if RAF <> invalid:
' RAF.setAdUrl(ad_url) 'use if assigned custom URL
pods = RAF.getAds()
ok = RAF.showAds(pods)
end if


Thank you! What file does the above go in?

What about these two things?
Library "Roku_Ads.brs" - where does this go? Main? If so, where in Main?
adIface = Roku_Ads() - where does this go? Main? If so, where in Main?
0 Kudos
BCVatOVG
Level 7

Re: Simplest possible way to integrate Roku- sourced ad feed

Library "Roku_Ads.brs"
Goes a the top of main file (outside of any functions)

adIface = Roku_Ads() goes in whatever function you are trying to set up the ads/play the ads.

In the case of the code you posted the adIface variable is actually RAF. so RAF = Roku_Ads() sets up the RAF variable, RAF.setAdUrl(ad_url) sets up a custom VMAP or VAST url, pods = RAF.getAds() will load the ads into the pods variable, ok = RAF.showAds(pods) will load and play the ads if there are any.
0 Kudos
uxicorp
Level 7

Re: Simplest possible way to integrate Roku- sourced ad feed

Hmmm...I'm more confused now than ever. I'm not a coder and just want to put ads on my channel. Do you have sample code I can cut and paste? Or maybe a simple Step 1, Step 2, etc.

"BCVatOVG" wrote:
Library "Roku_Ads.brs"
Goes a the top of main file (outside of any functions)

adIface = Roku_Ads() goes in whatever function you are trying to set up the ads/play the ads.

In the case of the code you posted the adIface variable is actually RAF. so RAF = Roku_Ads() sets up the RAF variable, RAF.setAdUrl(ad_url) sets up a custom VMAP or VAST url, pods = RAF.getAds() will load the ads into the pods variable, ok = RAF.showAds(pods) will load and play the ads if there are any.
0 Kudos
BCVatOVG
Level 7

Re: Simplest possible way to integrate Roku- sourced ad feed

"uxicorp" wrote:
I'm not a coder

How did you create a channel in the first place?

There is no "cut and paste" implementation for RAF without understanding the basics of BrightScript. Without your app code, I have no idea how you are playing videos or how to guide you to in setting up RAF to play video ads. I suggest you find or hire a coder to help you.
0 Kudos
uxicorp
Level 7

Re: Simplest possible way to integrate Roku- sourced ad feed

I just used the videoplayer example and just followed the guides to swapping the content.
0 Kudos