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

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 6
EnTerr
Roku Guru

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

To quote Komag, "welcome to Roku world!" :). 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
Visitor

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

"EnTerr" wrote:
To quote Komag, "welcome to Roku world!" :). 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
Visitor

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
Visitor

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
Visitor

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
Visitor

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