Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 7

RAF and VMAP support

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")

return screen
end function

sub showVideoScreen(screen As Object, episode As Object)
port = CreateObject("roMessagePort")
episode = getStreamForEpisode(episode, webClient())

playbackPosition = 0


shouldUseRAFAdsFallback = false
maxRetries = 2

adIface = Roku_ads()
adIface.SetAdPrefs(shouldUseRAFAdsFallback, maxRetries)


adPods = adIface.getAds()

'Play pre-roll
shouldPlayContent = adIface.showAds(adPods)

if shouldPlayContent then
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

shouldPlayContent = adIface.showAds(adPods)

if shouldPlayContent
screen = createVideoScreen()
end if
end if
end if

if msg.isScreenClosed()
shouldPlayContent = false
end if
end while

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.
0 Kudos
1 REPLY 1\
Level 10

Re: RAF and VMAP support

There's something odd about that URL. It explicitly specifies VMAP as the output format, but it's returning an XML playlist, instead. As far as I'm aware RAF doesn't support playlists, so you'll likely either need to parse the playlist yourself and pass the individual VAST URLs to RAF at the appropriate times, or figure out why you're not getting a VMAP response back (which RAF does support).
My Channels: - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos