I feel like there's something I'm missing. I'd like to fire off an ad between videos in a playlist, but I can't find a straight-forward way to do it. I put together this hack that sort of works:
if msg.GetField() = "position" then
' keep track of where we reached in content'
curPos = msg.GetData()
' Start ad at beginning of video'
if curIndex <> video.contentIndex
print "playing video:"
curIndex = video.contentIndex
print curIndex
' if ad has not played yet'
if adPlayed[video.contentIndex] <> true then
adPlayed[video.contentIndex] = true
' check for mid-roll ads'
adPods = RAF.getAds()
if adPods <> invalid and adPods.count() > 0
print "PlayerTask: mid-roll ads, stopping video"
'ask the video to stop - the rest is handled in the state=stopped event below'
video.control = "stop"
end if
end if
end if
end if
basically, I'm just checking if the current video id has changed and dropping in the ad. However, this allows for a flash of the next video to play before the ad loads. Is there anyway to have it more seamless?