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

RAF and ad pods

Due to a limitation of our ad server and having multiple demand partners......

Is there a way to tell RAF to play X number of ads regardless of how many are returned in the pod?  For example if the pod returns 5 and we want to play 3.

Where does this come from if debug is set "RAF.showAds(); rendering preroll pod of 5 ads"
0 Kudos
4 Replies
Roku Employee
Roku Employee

Re: RAF and ad pods

It's a RAF diagnostic. raf.showAds() plays all the ads that it is given, it does not do any selection.

raf.getAds(posn_msg) does select/return a pod from previously parsed pods coming from VMAP/SMRX but this does not seem to be your case.
For your case, i think you'll have to modify the ad-break structure prior to passing it to showAds(), so that it has the number of ads you desire. Rather simple to do. Check the data structure in RAF doco. Or dump it to console with "print formatJSON(ads)", format that in JSON pretty-printer and examine.
0 Kudos
SolveLLC
Level 7

Re: RAF and ad pods

"RokuNB" wrote:
It's a RAF diagnostic. raf.showAds() plays all the ads that it is given, it does not do any selection.

raf.getAds(posn_msg) does select/return a pod from previously parsed pods coming from VMAP/SMRX but this does not seem to be your case.
For your case, i think you'll have to modify the ad-break structure prior to passing it to showAds(), so that it has the number of ads you desire. Rather simple to do. Check the data structure in RAF doco. Or dump it to console with "print formatJSON(ads)", format that in JSON pretty-printer and examine.

Is there a method to return how many valid ads were parsed from getAds?
0 Kudos
Roku Employee
Roku Employee

Re: RAF and ad pods

"SolveLLC" wrote:
Is there a method to return how many valid ads were parsed from getAds?

getAds() returns an array of pods in this format (though i find it easier to dump formatJSON() and work on example, what i recommended), so just taking .count() of that will give you the number of pods. To count the ads per pod, you'll have to drill down a little deeper. But if i recollect, only the valid ads are retained per pod (the slots remaining empty are dropped).
0 Kudos
SolveLLC
Level 7

Re: RAF and ad pods

"RokuNB" wrote:
"SolveLLC" wrote:
Is there a method to return how many valid ads were parsed from getAds?

getAds() returns an array of pods in this format (though i find it easier to dump formatJSON() and work on example, what i recommended), so just taking .count() of that will give you the number of pods. To count the ads per pod, you'll have to drill down a little deeper. But if i recollect, only the valid ads are retained per pod (the slots remaining empty are dropped).

Thanks!
0 Kudos