How to add Ads in the adpod from two different APIs?

Hi All,

I am trying to find the solution for showing the Ads from two different APIs, which is to be added in a single adpod.

Any help or source code would be appreciated :slightly_smiling_face:

You can do that, see the ad structure that can be used to RAF.importAds()
https://sdkdocs.roku.com/display/sdkdoc … dStructure

It’s an array of ad pods. Where each pod is AA with ads being an array of ads. You can simply do

myAdPod.ads.append(newAd)
myAdPod.duration += newAd.duration

something like that

adIface = Roku_Ads()
url = “”
m.adIface.setAdUrl(url)

adPods = m.adIface.getAds()
if adPods <> invalid and adPods.Count() > 0
shouldPlayContent = m.adIface.showAds(adPods)
end if[/color]

^Code snippet is somewhat like this, In case of passing Array of URLs (Two different URLs) I am getting an exception
Can you suggest the changes?

Actually, I was able to play 3 ads using 3 different URL in sequence. but I want to show the adPods count 1 of 3, 2 of 3 and 3 of 3. currently it shows 1 of 1 for each ad.

something like this? (typed, not tried)


adBreak = invalid 
for each url in urls
    raf.setAdUrl(url)
    adPods = raf.getAds()
    if adPods <> invalid and adPods.Count() > 0 
        if adBreak = invalid
            adBreak = adPods 
        else ' assuming VAST, only 1 pod '
            adBreak[0].ads.append(adPods[0].ads)
            adBreak[0].duration += adPods[0].duration
        end if 
    end if
next 
if adBreak <> invalid 
   shouldPlayContent = raf.showAds(adBreak)
end if