InStream Ad
Characteristics
Three types of in-stream video ads are supported: pre-roll, mid-roll and post-roll.
Pre-roll ads
Pre-roll ads are displayed before the content video. Ads are played once user starts the playback of content video.
Post-roll ads
Post-roll ads are displayed after the content video finished playing. Ads are played once the content video finished playing.
Mid-roll ads
Mid-roll ads are served in the middle of content video at each cue points. Multiple mid-roll ads can be arranged in single video.
Cue points at which to show ads are defined in 3 different policies, Every N Seconds, Fixed Time or Fixed Percentage.
Ad break at each cue point manages duration and number of video ad to be played in 3 different rules, Single, Fixed time or Multi Ad.
Integration
Add Files for InStream Ad Integration
Add CEInStreamAD.h and CEInStreamAD.m
to app's build target.
Declare InStream Ad
Import
CEInStreamAD.h
Set up
CEInStreamADDelegate
andCEContentProgressProvider
protocol in view controller's extension.Create a CEInStreamAD instance and keep its reference.
Initialize InStream Ad
Initialize CEInStreamAD instance and necessary properties.
Request InStream Ad
startAutoRequestAD
must be called after CEInStreamAD instance is initializedstartAutoRequestAD
shall be called before video content is played, otherwise ad breaks in the beginning of the video, pre-roll ad especially, will be wastedPlease call
startAutoRequestAD
for only one time for each CEInStreamAd instance.
Implement CEInStreamADDelegate to handle InStream Ad Event
Implement CEContentProgressProvider to update Video Content Status
isContentPlayerReady
,getContentCurrentPosition
andgetContentTotalDuration
must be implemented otherwise InStream ad will not be servedPlease read this carefully: During the time user is seeking the video, app should always return the progress time that user start seeking instead of the current time that user has sought to. Once user stop seeking, please return the progress time that user stopped at.
Release InStream Ad
InStream ad shall at least be released along with the life cycle of video content
Last updated