我正在运行来自Roku网站的RAF示例代码中的midroll广告网址。我测试了谷歌IMA视频套件ispector中的网址,它有一个预卷,一个midroll和一个postroll广告。该代码适用于没有任何midroll广告(单个VAST代码)的preroll网址。但是,VAMP网址中的广告都没有播放以下代码。当我打印' adPods.count()'我总是得到0的结果。 适用于:单一,内联,线性广告 - http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=
以下是代码:
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)
adIface.setAdUrl("http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=")
adPods = adIface.getAds()
print "printing adpods count here.."
print adPods.count()
playContent = adIface.showAds(adPods) ' show preroll ad pod (if any)
curPos = 0
if playContent
videoScreen = PlayVideoContent(videoContent)
end if
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
'check for midroll/postroll ad pods
adPods = adIface.getAds(videoMsg)
if adPods <> invalid and adPods.Count() > 0
' stop video playback to prepare for midroll ad render
videoScreen.Close()
playContent = adIface.showAds(adPods)
if playContent
' resume video playback after midroll ads
videoContent.PlayStart = curPos
videoScreen = PlayVideoContent(videoContent)
end if
' if !playContent, User exited ad view, returning to content selection
end if ' adPods <> invalid
if videoMsg.isFullResult() or videoMsg.isRequestFailed() or videoMsg.isPartialResult() or videoMsg.isScreenClosed()
playContent = false
end if
end if ' roVideoScreenEvent
end while
if type(videoScreen) = "roVideoScreen" then videoScreen.Close()
End Sub
答案 0 :(得分:1)
后代的链接 - 似乎正在http://forums.roku.com/viewtopic.php?f=34&t=89457
回答答案 1 :(得分:1)
尝试更新包装盒上的固件。软件更新也将更新RAF。旧版本的RAF可能无法正确解析此XML。