简体   繁体   English

使用Roku广告框架(RAF)的DFP VMAP插播广告

[英]DFP VMAP midroll ads using Roku Ad Framework (RAF)

I am running the midroll ad urls in RAF sample code that I got from Roku website. 我正在从Roku网站获得的RAF示例代码中运行Midroll广告网址。 I tested the url in google IMA video suite ispector and it has a preroll, a midroll and a postroll ad. 我在google IMA视频套件ispector中测试了该网址,它具有预卷,中插和后插广告。 The code works for preroll url that does not have any midroll ads (single VAST tag). 该代码适用于没有任何插播广告(单个VAST标签)的插播网址。 But none of the ads from a VAMP url are playing in following code. 但是,VAMP网址中的所有广告都没有在以下代码中播放。 When i do print 'adPods.count()' I always get result as 0. Works for : single, inline, linear ad - 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= 当我做打印“adPods.count()”我总是得到结果为0作品为:单,直列,线性广告- http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096 /外部/ single_ad_samples&ciu_szs = 300x250的&IMPL = S&gdfp_req = 1&ENV = VP&输出=广阔&unviewed_position_start = 1&cust_params =部署%3Ddevsite%26sample_ct%3Dlinear&相关=

Does not work for VMAP Pre-, Mid-, and Post-rolls, Single Ads : 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= 不适用于VMAP片前,片中和片后广告,单个广告: 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&输出= VMAP&unviewed_position_start = 1&cust_params =部署%3Ddevsite%26sample_ar%3Dpremidpost&为cmsid = 496&VID = short_onecue&相关=

Here is the code: 这是代码:

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

后代链接-似乎正在http://forums.roku.com/viewtopic.php?f=34&t=89457上得到回答

Try updating firmware on your box. 尝试更新包装盒上的固件。 Software update will update RAF as well. 软件更新也将更新RAF。 Older versions of RAF might not be able to parse this XML correctly. 较旧的RAF版本可能无法正确解析此XML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM