CEInStreamAD
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 to app's build target.
Declare InStream Ad
Import
CEInStreamAD.hSet up
CEInStreamADDelegateandCEContentProgressProviderprotocol 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
startAutoRequestADmust be called after CEInStreamAD instance is initializedstartAutoRequestADshall be called before video content is played, otherwise ad breaks in the beginning of the video, pre-roll ad especially, will be wasted**Please call
startAutoRequestADfor only one time for each CEInStreamAd instance.**
Implement CEInStreamADDelegate to handle InStream Ad Event
Implement CEContentProgressProvider to update Video Content Status
isContentPlayerReady,getContentCurrentPositionandgetContentTotalDurationmust 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
Advance Integration
CEVideoViewProfileInStreamDefaultProfilecan be configured base on your need on InStream ad:

7 properties in total for InStream ad. Properties in CEVideoViewProfile represent different elements on InStream ad UI. (Please refer to diagram above)
CEVideoViewProfileInStreamDefaultProfile: All elements included and volume on when InStream ad start playingCEVideoViewProfileSilentStart: Volume off when InStream ad start playing(A)
CEVideoViewProfileSpeaker: Top left speaker(B)
CEVideoViewProfileAdCount: Bottom left AdCount(C)
CEVideoViewProfileAdIcon: Top right ad icon(D)
CEVideoViewProfileCountDown: Top right count down timer(E)
CEVideoViewProfileSkipButton: Bottom right skip button
Customized Skip Button 1. Please exclude
CEVideoViewProfileSkipButtonfrom CEVideoViewProfile instance otherwise customized view will be overlapped by default Skip view. 2. Pass the customized view throughregisterViewForDismissto enable Skip function of customized view. Please callregisterViewForDismissbeforestartAutoRequestADin case Skip function did not work on InStream ad. 3. Customized view must be passed byregisterFriendlyObstructionif it is on top of and overlap InStream ad. 4. [Recommended] Mechanism to show and hide customized Skip button need to be handled by app. Default Skip button from Intowow SDk needs no effort from app and is recommended.
Please pass any views that overlap ad view by
registerFriendlyObstructionfor the completeness of viewability tracking
API Reference
Public constructors
initWithPlacement:(NSString )placement adContainer:(UIView)adContainer videoViewProfile:(CEVideoViewProfile)videoViewProfile (Deprecated) Instantiates a new InStream ad.
Public methods
void
registerViewForDismiss:(nonnull UIView *)view Register view as Skip button.
void
registerFriendlyObstruction:(nonnull NSArray*)views Please pass any views that overlap ad view so that viewability tracking can be completed.
void
startAutoRequestAD
Request in-stream ads automatically.
It shall only be called after CEInStreamAd is intialized.
Please call startAutoRequestAD for only one time for each CEInStreamAd instance.
void
contentComplete Notification of the end of video content. It is critical to ensure Post-roll ad being served. If it is called in the middle of video content and there is ad to be served, post-roll ad will be served.
void
play Play InStream ad.
void
stop Stop InStream ad. Once certain InStream video ad is stopped, it cannot resumes playing.
void
destroy Release InStream ad. InStream ad shall at least be released along with video player.
nullable NSArray <NSNumber*> *
getCuePoints
Return an array of cue points in NSNumber representing milli-second.
Return nil if total duration of content video is not available.
int
getCurrentADNum
Return the index(Start from 1) of InStream ad that is playing out of the number of ad should be served in current ad break.
It should be called during ad break, otherwise it will return kCECurrentADNumInvalid.
int
getTotalADNum
Return the total number of InStream that is expected to be played within current ad break.
If it is not called in ad break or it is called in ad break but the total number of ad is not predictable, kCEToTalADNumInvalid will be returned.
CEMilliSec
getADBreakRemainTime
Return the time left for current ad break.
If it is not called in ad break or it is called in ad break but the remaining time of ad break cannot be calculated, getADBreakRemainTime will be returned.
CEMilliSec
getADRemainTime
Return the time left for current playing InStream ad.
It should be called during ad break, otherwise it will return kCEADRemainTimeInvalid.
Public Properties
NSDictionary
customEventExtra Extra info that is passed in third-party custom event when InStream Ad is loaded. It is a nullable value, null is expected to receive if no key-value is set.
Public Constructors
initWithRequestInfo
Instantiates a new InStream ad.
Parameters
info
Request information
adContainer
UIView that ad will be played on
videoViewProfile
CEVideoViewProfile to define elements to be shown on Video ad. CEVideoViewProfileInStreamDefaultProfile will include all supporting elements with auto volume control. (Supporting MACRO: CEVideoViewProfileSpeaker, CEVideoViewProfileCountDown, CEVideoViewProfileSilentStart, CEVideoViewProfileAdIcon, CEVideoViewProfileSkipButton, CEVideoViewProfileAdCount)
(Deprecated)initWithPlacement
Instantiates a new InStream ad.
Parameters
placement
A specific group of ad units denoted in NSString, on which an advertiser can choose to place their ads using placement targeting
adContainer
UIView that ad will be played on
videoViewProfile
CEVideoViewProfile to define elements to be shown on Video ad. CEVideoViewProfileInStreamDefaultProfile will include all supporting elements with auto volume control. (Supporting MACRO: CEVideoViewProfileSpeaker, CEVideoViewProfileCountDown, CEVideoViewProfileSilentStart, CEVideoViewProfileAdIcon, CEVideoViewProfileSkipButton, CEVideoViewProfileAdCount)
Public Methods
registerViewForDismiss
Register view as Skip button.
Parameters
view
UIView to be registered for skip event.
registerFriendlyObstruction
Please pass any views that overlap ad view so that viewability tracking can be completed.
Parameters
views
UIView NSArray storing all views overlapping InStream ad
startAutoRequestAD
Request in-stream ads automatically. It shall only be called after CEInStreamAd is intialized. Please call startAutoRequestAD for only one time for each CEInStreamAd instance.
contentComplete
Notification of the end of video content. It is critical to ensure Post-roll ad being served. If it is called in the middle of video content and there is ad to be served, post-roll ad will be served.
play
Play InStream ad.
stop
Stop InStream ad. Once certain InStream video ad is stopped, it cannot resume playing.
destroy
Release InStream ad. InStream ad shall at least be released along with the life cycle of video content.
getCuePoints
Return an array of cue points in NSNumber representing milli-second. Return nil if total duration of content video is not available.
Returns
NSArray<NSNumber *>*
NSNumber array with all cue points in NSNumber representing milli-second
getCurrentADNum
Return the index(Start from 1) of InStream ad that is playing out of the number of ad should be served in current ad break. It should be called during ad break, otherwise it will return kCECurrentADNumInvalid.
Returns
int
The index of InStream ad that is playing in current ad break
getTotalADNum
Return the total number of InStream ad that is expected to be played within current ad break. If it is not called in ad break or it is called in ad break but the total number of ad is not predictable, kCEToTalADNumInvalid will be returned.
Returns
int
Total number of InStream ad that is expected to be played in current ad break
getADBreakRemainTime
Return the time left for current ad break. If it is not called in ad break or it is called in ad break but the remaining time of ad break cannot be calculated, getADBreakRemainTime will be returned.
Returns
CEMilliSec
The time left for current ad break
getADRemainTime
Return the time left for current playing InStream ad. It should be called during ad break, otherwise it will return kCEADRemainTimeInvalid.
Returns
CEMilliSec
The time left for current playing InStream ad
Public Properties
customEventExtra
Extra info that is passed in third-party custom event when InStream Ad is loaded.
Last updated