使用Roku广告框架(RAF)的DFP VMAP中期广告
我正在运行从Roku网站获得的RAF示例代码中的midroll广告URL。我在google IMA视频套件ispector中测试了该url,它有一个预滚、中滚和后滚广告。该代码适用于没有任何中滚广告的预滚url(单个巨大标记)。但是,在下面的代码中,没有一个来自VAMP url的广告在播放。当我打印“adPods.count()”时,结果总是为0。 适用于:单个、内联、线性ad- 不适用于VMAP卷前、卷中和卷后、单个广告: 代码如下:使用Roku广告框架(RAF)的DFP VMAP中期广告,roku,brightscript,Roku,Brightscript,我正在运行从Roku网站获得的RAF示例代码中的midroll广告URL。我在google IMA视频套件ispector中测试了该url,它有一个预滚、中滚和后滚广告。该代码适用于没有任何中滚广告的预滚url(单个巨大标记)。但是,在下面的代码中,没有一个来自VAMP url的广告在播放。当我打印“adPods.count()”时,结果总是为0。 适用于:单个、内联、线性ad- 不适用于VMAP卷前、卷中和卷后、单个广告: 代码如下: Sub PlayContentWithAds(videoC
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
Sub-PlayContentWithAds(视频内容作为对象)
canvas=CreateObject(“roImageCanvas”)
canvas.SetLayer(1,{color:#000000})
canvas.SetLayer(2,{text:“加载…”})
canvas.Show()
adIface=Roku_Ads()
打印“Roku_广告库版本:”+adIface.getLibVersion()
'通常,将在此处设置发布者的广告URL。否则使用默认Roku ad服务器(带有单个预滚占位符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()
打印“此处打印adpods计数…”
打印adPods.count()
playContent=adIface.showAds(adPods)‘播放预演广告播客’(如有)
curPos=0
如果播放内容
视频屏幕=播放视频内容(视频内容)
如果结束
而游戏内容
videoMsg=wait(0,videoScreen.GetMessagePort())
如果类型(videoMsg)=“roVideoScreenEvent”
如果videoMsg.isStreamStarted()
canvas.ClearLayer(2)
如果结束
如果videoMsg.isPlaybackPosition()为
'缓存当前播放位置,以便在播放中期广告后继续播放
curPos=videoMsg.GetIndex()
如果结束
'检查中期/后期广告播客
adPods=adIface.getAds(videoMsg)
如果adPods无效且adPods.Count()大于0
'停止视频播放以准备中期滚动广告渲染
视频屏幕关闭
playContent=adIface.showAds(adPods)
如果播放内容
'在播放中期广告后恢复视频播放
videoContent.PlayStart=curPos
视频屏幕=播放视频内容(视频内容)
如果结束
“如果!播放内容,用户退出广告视图,返回内容选择
如果“adPods”无效,则结束
如果videoMsg.isFullResult()或videoMsg.isRequestFailed()或videoMsg.isPartialResult()或videoMsg.isScreenClosed()
playContent=false
如果结束
“如果”事件结束,则结束
结束时
如果类型(videoScreen)=“roVideoScreen”,则videoScreen.Close()
端接头
子孙后代链接-这似乎在尝试更新机箱上的固件。软件更新也将更新RAF。RAF的旧版本可能无法正确解析此XML。谢谢:)它开始使用RAF 1.4。直到上周,我还认为我是在RAF 1.4上。嗨,你能加入这个聊天室吗?chat.stackoverflow.com/rooms/125654/rokuThis通过论坛上的互动和将我的roku lib版本更新到1.4后得到了解决