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

RAF 1.4 - Preroll Ads Not Working With My URL

Hello,

I'm trying the RokuAdFrameworkSample that comes with the RAF documentation.

If I just add my adserver URL, the preroll ad that's supposed to run doesn't but instead what look like ads from the Roku ad server run (ads for Slim Jim, LG phone).

Here is my adserver tag (it is from Revive adserver)

url = "http://www.managedtime.com/adserver/www/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&zones=pre-roll0-0%3D4&nz=1&source=&r=R0.023106331005692482&block=1&format=vast&charset=UTF-8"



Here is the code for main.brs from RokuAdFrameworkSample

Library "Roku_Ads.brs"

sub Main(params)
' lengthy (20+ min.) TED talk to allow time for testing multiple ad pods
videoContent = { streamFormat : "mp4" }
videoContent.stream = { url: "http://video.ted.com/talks/podcast/DavidKelley_2002_480.mp4",
bitrate: 800,
quality: false
}
PlayContentWithAds(videoContent)
end sub

Function PlayVideoContent(content as Object) as Object
' roVideoScreen just closes if you try to resume or seek after ad playback,
' so just create a new instance of the screen...
videoScreen = CreateObject("roVideoScreen")
videoScreen.SetContent(content)
' need a reasonable notification period set if midroll/postroll ads are to be
' rendered at an appropriate time
videoScreen.SetPositionNotificationPeriod(1)
videoScreen.SetMessagePort(CreateObject("roMessagePort"))
videoScreen.Show()

return videoScreen
End Function

Sub PlayContentWithAds(videoContent as Object)
canvas = CreateObject("roImageCanvas")
canvas.SetLayer(1, {color: "#000000"})
canvas.SetLayer(2, {text: "Loading..."})
canvas.Show()

adIface = Roku_Ads()
print "Roku_Ads library version: " + adIface.getLibVersion()
' Normally, would set publisher's ad URL here. Otherwise uses default Roku ad server (with single preroll placeholder ad)
url = "http://www.managedtime.com/adserver/www/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&zones=pre-roll0-0%3D4&nz=1&source=&r=R0.023106331005692482&block=1&format=vast&charset=UTF-8"
adIface.setAdUrl(url)
print "getAdUrl says ..."
print adIface.GetAdUrl()

adPods = adIface.getAds()
playContent = adIface.showAds(adPods) ' show preroll ad pod (if any)

curPos = 0
if playContent
videoScreen = PlayVideoContent(videoContent)
end if

closingContentScreen = false
contentDone = false
while playContent
videoMsg = wait(0, videoScreen.GetMessagePort())
if type(videoMsg) = "roVideoScreenEvent"
if videoMsg.isStreamStarted()
canvas.ClearLayer(2)
end if
if videoMsg.isPlaybackPosition()
' cache current playback position for resume after midroll ads
curPos = videoMsg.GetIndex()
end if

if not closingContentScreen ' don't check for any more ads while waiting for screen close
if videoMsg.isScreenClosed() ' roVideoScreen sends this message last for all exit conditions
playContent = false
else if videoMsg.isFullResult()
contentDone = true ' don't want to resume playback after postroll ads
end if

' check for midroll/postroll ad pods
adPods = adIface.getAds(videoMsg)
if adPods <> invalid and adPods.Count() > 0
' must completely close content screen before showing ads
' for some Roku platforms (e.g., RokuTV), calling Close() will not synchronously
' close the media player and may prevent a new media player from being created
' until the screen is fully closed (app has received the isScreenClosed() event)
videoScreen.Close()
closingContentScreen = true
end if
else if videoMsg.isScreenClosed()
closingContentScreen = false ' now safe to render ads
end if ' closingContentScreen

if not closingContentScreen and adPods <> invalid and adPods.Count() > 0
' now safe to render midroll/postroll ads
playContent = adIface.showAds(adPods)
playContent = playContent and not contentDone
if playContent
' resume video playback after midroll ads
videoContent.PlayStart = curPos
videoScreen = PlayVideoContent(videoContent)
end if
end if ' !closingContentScreen
end if ' roVideoScreenEvent
end while
if type(videoScreen) = "roVideoScreen" then videoScreen.Close()
End Sub


...Like I said, it's stock sample code & I only added these lines

url = "http://www.managedtime.com/adserver/www/delivery/fc.php?script=bannerTypeHtml:vastInlineBannerTypeHtml:vastInlineHtml&zones=pre-roll0-0%3D4&nz=1&source=&r=R0.023106331005692482&block=1&format=vast&charset=UTF-8"
adIface.setAdUrl(url)
print "getAdUrl says ..."
print adIface.GetAdUrl()


Any insight as to why I'm not seeing the ad I expect to see?

- Thanks,
0 Kudos
4 REPLIES 4
RokuChris
Roku Employee
Roku Employee

Re: RAF 1.4 - Preroll Ads Not Working With My URL

I did a quick validation of your ad response against the VAST 3 XSD and got several errors. First, your root XML element isn't called VAST:

Cvc-elt.1: Cannot Find The Declaration Of Element 'VideoAdServingTemplate'.. Line '1', Column '103'.


Once I fixed that these popped up:

Cvc-complex-type.4: Attribute 'version' Must Appear On Element 'VAST'.. Line '1', Column '102'.
Cvc-complex-type.2.2: Element 'Impression' Must Have No Element [children], And The Value Must Be Valid.. Line '7', Column '34'.
Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'Video'. One Of '{Impression, Creatives}' Is Expected.. Line '8', Column '15'.


http://www.iab.com/guidelines/digital-v ... -vast-3-0/
0 Kudos
gaiusbaltaar
Visitor

Re: RAF 1.4 - Preroll Ads Not Working With My URL

Thanks for checking. Instead of trying to fix Revive adserver XML, I tried with DFP adserver.

I just put in this tag

url = "https://pubads.g.doubleclick.net/gampad/ads?sz=400x300|640x480|320x240|1280x720&iu=/168775852/ABCD-Video&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&description_url=[description_url]&correlator=[timestamp]"


which is straight outta DFP. Still can not get the ad to run.
0 Kudos
gaiusbaltaar
Visitor

Re: RAF 1.4 - Preroll Ads Not Working With My URL

SOLVED!

The DFP does return a valid XML but I did not set up the parameters correctly in DFP for the video.

I had set up the video type as video/x-flv instead of video/mp4 in DFP. When I made the change in DFP, the ad started to run in Roku.

Interesting though that the tag URL is still
   url = "https://pubads.g.doubleclick.net/gampad/ads?sz=400x300|640x480|320x240|1280x720&iu=/168775852/ABCD-Video&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&description_url=[description_url]&correlator=[timestamp]"


I thought you needed to program actual values for [referrer_url], [description_url] and [timestamp]
0 Kudos
brohoward
Visitor

Re: RAF 1.4 - Preroll Ads Not Working With My URL

how did you set video type to video/mp4 in DFP? when i upload my creative there, it automatically generates over half a dozen types, including both mp4 and flv - and i am currently seeing what you did - only default Roku ad pre-roll plays - never my DFP pre-roll - despite the fact my DFP URL is in the code - thanks!
0 Kudos