When playing a movie, I would like to show some ads using AVInterstitialTimeRange. I was able to create the "dots" on the progress bar when playing the movie, but how do I actually present the ads?
so far this is my code to present the ads.
NSArray *adBreaks = result.adBreaks;
_player.player.currentItem.interstitialTimeRanges = adBreaks;
NSMutableArray *adBreaksCMTime = [[NSMutableArray alloc]init];
for(AdBreak *brk in adBreaks) {
CMTime seekingCM = CMTimeMake([brk adBreakTime], 1);
CMTime durationCM = CMTimeMake([brk adBreakDuration], 1);
AVInterstitialTimeRange *adTimeRange = [[AVInterstitialTimeRange alloc]initWithTimeRange:CMTimeRangeMake(seekingCM, durationCM)];
[adBreaksCMTime addObject:adTimeRange];
}
_player.player.currentItem.interstitialTimeRanges = adBreaksCMTime;