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: 

Roku ad Framework For Each error vast response

Hi,
I am trying to play a pre-roll video ad using Roku ad Framework, but am getting an error in the console, though the ad is played.
When trying to execute the following code in isolate environment I get the following error:


adIface = Roku_Ads()
vastURL = "my valid vast URL"
adIface.setAdUrl(vastURL)
adPods = adIface.getAds()
print "adPods are ",adPods

for each key in adPods
print " " key
end for

for each key in adPods
print " " adPods[key]
end for

Attempt to use a non-numeric array index not allowed at print " " adPods[key]

and when I try to show ads, I get the following error:

adIface.showAds(adPods)

BRIGHTSCRIPT: ERROR: Runtime: FOR EACH value is Invalid: roku_ads_lib:/Roku_Ads.brs(2729)

I followed everything said in the RAF. Am I doing something wrong ?
0 Kudos
1 Reply
EnTerr
Level 9

Re: Roku ad Framework For Each error vast response

"bathejasumeet" wrote:

... Attempt to use a non-numeric array index not allowed at print " " adPods[key]

adPods is an array of dictionaries. Try

for each apod in adPods
for each key in apod
print key, apod[key]
end for
print "--------------"
end for


BRIGHTSCRIPT: ERROR: Runtime: FOR EACH value is Invalid: roku_ads_lib:/Roku_Ads.brs(2729)

I followed everything said in the RAF. Am I doing something wrong ?

Here you fell victim to design. Check with RokuKC for alternative wording 8-)
0 Kudos