InStreamAd
package com.intowow.sdk
public class InStreamAd
Characteristics
There are three types of in-stream video ads: pre-roll, mid-roll and post-roll.
Pre-roll ads
Pre-roll ads are displayed before the content video. These ads are played only once when user starts the playback of content video.
Post-roll ads
Post-roll ads are displayed after the content video has finished playing. These ads are played only once when the content video has finished playing.
Mid-roll ads
Mid-roll ads are shown in the middle of content video at breakpoints. Mid-roll ads may be shown multiple times during single video. Mid-roll ad can be served depends on cue points.
Cue points at which to show ads may be defined in several ways in Mid-roll ads. You can display ads by Every n seconds, Fixed time or Fixed percentage.
Ad break at each cue point can choose the following rule to play video ad in the Ad break, Single, Fixed time or Multi Ad.
Integration
Declare InStreamAd
Create a InStreamAd instance and keep its reference.
Initialize InStreamAd
Implement InStreamAdListener to handle InStreamAd Event
Request InStreamAd
startAutoRequestAd
must be called after InStreamAd 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 called
startAutoRequestAd
only one time.
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 InStreamAd
InStream ad shall at least be released along with the life cycle of video content
Advance Integration
Note
AdProperty
You could use
AdProperty
to configure your ad if necessary:
(A)AdProperty.HIDE_SPEAKER
: if need to hide the speaker on top left corner, the default value is false.
(B) AdProperty.HIDE_AD_COUNT_VIEW
: if need to hide the ad count view on bottom left corner, the default value is false.
(C) AdProperty.HIDE_AD_ICON
: if need to hide the ad icon on top right corner, the default value is false.
(D) AdProperty.HIDE_COUNTDOWN
: if need to hide the count down timer on top right corner, the default value is false.
(E) AdProperty.HIDE_NON_SKIPPABLE_BUTTON
: if need to hide skippable button on bottom right corner, the default value is false.
(F) AdProperty.SILENT_START
: auto silent play, the default value is true.
Customized Skip Button
Put the AdProperty to
HIDE_NON_SKIPPLE_BUTTON
or the customized skip button will overlap with default one.Customized view must be passed by
registerFriendlyObstruction
if it is on top of and overlap InStream ad.[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.
API Reference
Public constructors
Public methods
void
void
void
void
void
void
void
void
void
void
List< Long >
int
int
long
long
JSONObject
Public Constructors
InStreamAd
Instantiates a new InStream ad.
Parameters
context
Context
placement
String: A specific group of ad units on which an advertiser can choose to place their ads using placement targeting
adProps
Map: the ad property
adContainer
ViewGroup: ViewGroup that Ad belongs to
RequestInfo
RequestInfo: Extra info for requesting AD. If no additional info is needed, APP can pass either null or the requestInfo instance.
InStreamAd(Deprecated)
Instantiates a new InStream ad.
Parameters
context
Context
placement
String: A specific group of ad units on which an advertiser can choose to place their ads using placement targeting
adProps
Map: the ad property
adContainer
ViewGroup: ViewGroup that Ad belongs to
Public Methods
registerViewForDismiss
Register view as Skip button.
Parameters
view
View: The View to be registered for skip event.
registerFriendlyObstruction
Please pass any views that overlap ad view so that viewability tracking can be completed.
Parameters
views
List: List of View storing all views overlapping InStream ad
setAdListener
Set ad listener to InStream ad.
Parameters
listener
InStreamAdListener
setContentProgressProvider
Set contentProgressProvider to InStream ad.
Parameters
contentProgressProvider
CEContentProgressProvider
setAdSize
Set adsize to InStream ad.
Parameters
adSize
CEAdSize
startAutoRequestAd
Request in-stream ads automatically. It shall only be called once after InStreamAd is intialized.
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 a list of cue points in Long representing milli-second. Return null
if total duration of content video is not available.
Returns
List< Long >
List with all cue points in Long 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 CE_CURRENT_AD_NUM_INVALID
.
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, CE_TOTAL_AD_NUM_INVALID
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, CE_AD_BREAK_REMAIN_TIME_INVALID
will be returned.
Returns
long
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 CE_AD_REMAIN_TIME_INVALID
.
Returns
long
The time left for current playing InStream ad
getExtra
Return the extra info that is set in custom event. Receiving null is expected if no object is set.
Returns
JSONObject
The extra info that is set in custom event.
Last updated