I have looked at the several posted related but they did nothing to alleviate my issues.
RAF 1.4
SF version 7.0 (9021)
I have the below code:
function createVideoScreen()
screen = CreateObject("roVideoScreen")
screen.SetLoop(true)
screen.SetPositionNotificationPeriod(1)
return screen
end function
sub showVideoScreen(screen As Object, episode As Object)
port = CreateObject("roMessagePort")
episode = getStreamForEpisode(episode, webClient())
playbackPosition = 0
screen.SetContent(episode)
screen.SetMessagePort(port)
shouldUseRAFAdsFallback = false
maxRetries = 2
adIface = Roku_ads()
adIface.SetAdPrefs(shouldUseRAFAdsFallback, maxRetries)
adIface.setAdUrl("https://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()
'Play pre-roll
shouldPlayContent = adIface.showAds(adPods)
if shouldPlayContent then
screen.Show()
end if
while shouldPlayContent
msg = wait(0, port)
if msg.isPlaybackPosition() then
episode.PlayStart = msg.GetIndex()
adPods = adIface.getAds(msg)
if adPods <> invalid and adPods.Count() > 0
print "Ad break hit @ " episode.PlayStart
screen.Close()
shouldPlayContent = adIface.showAds(adPods)
if shouldPlayContent
screen = createVideoScreen()
screen.SetMessagePort(port)
screen.SetContent(episode)
screen.Show()
end if
end if
end if
if msg.isScreenClosed()
shouldPlayContent = false
end if
end while
screen.Close()
end sub
function getStreamForEpisode(episode As Object, client As Object) As Object
stream = client.getUrlForContent(episode.contentId)
episode.Stream = {
url: stream.url,
bitrate: 0,
quality: false
}
episode.PlayStart = 0
episode.StreamFormat = "hls"
episode.adUrl = stream.vmapUrl
return episode
end function
But the adpod count is 0. Works on Google IMA's video inspector and any of the ads that aren't a playlist work. Looking on some input on why this isn't working and how to make it work.
In the above example I am using the google ima test ad directly.