public final class InstreamAd extends BaseAd
| Modifier and Type | Class and Description |
|---|---|
static class |
InstreamAd.InstreamAdBanner
Model for InStream banner
|
static interface |
InstreamAd.InstreamAdListener |
adConfig, metricFactory| Constructor and Description |
|---|
InstreamAd(int slotId,
android.content.Context context)
Public constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
configureMidpoints(float videoDuration)
Sets the duration of the main video.
|
void |
configureMidpoints(float videoDuration,
float[] midpoints)
Sets the duration of the main video.
|
void |
configureMidpointsPercents(float videoDuration,
float[] midpointsPercents)
Allows you to set the duration of the main video in seconds and an array of banner midroll
points in percent.
|
void |
destroy()
Destroys the ad and frees resources
|
InstreamAd.InstreamAdListener |
getListener()
Get events listener of an advertisement
|
int |
getLoadingTimeout() |
float[] |
getMidPoints()
Method for getting a list of points at which video banners will be played.
|
InstreamAdPlayer |
getPlayer()
Player was set to play video ad.
|
int |
getVideoQuality()
Gets desired video quality of loading video.
|
java.util.List<java.lang.String> |
getVideoSectionNames()
Video section is sequence of videos based on position inside video.
|
float |
getVolume() |
void |
handleClick()
This should be called when user clicks on ad call-to-action element.
|
boolean |
isFullscreen() |
void |
load()
Start loading ads.
|
void |
pause()
Pauses ad video
|
void |
resume()
Resumes ad video from pause
|
void |
setFullscreen(boolean fullscreen)
The fullscreen property is intended to inform the InstreamAd component about changing the
video playback mode to fullscreen and back.
|
void |
setListener(InstreamAd.InstreamAdListener listener)
Set events listener of an advertisement
Must be called before
load() |
void |
setLoadingTimeout(int loadingTimeout)
An Ad loading timeout can be set before loading ad.
|
void |
setPlayer(InstreamAdPlayer player)
Sets custom implementation of
InstreamAdPlayer. |
void |
setVideoQuality(int videoQuality)
Desired video quality can be set.
|
void |
setVolume(float volume)
Allows you to control the volume of video playback and affects the sending of statistics of
sound changes.
|
void |
skip()
Explicitly ends playing current section/sequence of ad videos.
|
void |
skipBanner()
Explicitly ends playing current video banner.
|
void |
startMidroll(float point)
Starts the "midroll" section of video ad at point.
|
void |
startPauseroll()
Starts the "pauseroll" section of video ad
|
void |
startPostroll()
Starts the "postroll" section of video ad
|
void |
startPreroll()
Starts the "preroll" section of video ad
|
void |
stop()
Stops ad video
|
void |
swapPlayer(InstreamAdPlayer player)
Swaps player to another with saving it's state.
|
void |
useDefaultPlayer()
Sets the default player to play video ads.
|
void |
useDefaultPlayer(boolean useExoPlayer)
Sets the default player to play video ads.
|
getCustomParams, isLoadCalledpublic InstreamAd(int slotId,
@NonNull
android.content.Context context)
slotId - your slot idcontext - app context@NonNull public java.util.List<java.lang.String> getVideoSectionNames()
startPreroll()
called, and nothing will happen if startPostroll() called.
Ad can contain one or multiple video sections to play. This method represents available
sections for this ad.@Nullable public InstreamAd.InstreamAdListener getListener()
InstreamAd.InstreamAdListenerpublic void setListener(@Nullable
InstreamAd.InstreamAdListener listener)
load()InstreamAd.InstreamAdListenerpublic int getLoadingTimeout()
setLoadingTimeout(int)public void setLoadingTimeout(int loadingTimeout)
InstreamAd.InstreamAdListener.onNoAd(String, InstreamAd) will be called. Default value is 10
seconds, minimum 5 seconds. If value less than 5 seconds set, it will be 5 seconds.loadingTimeout - desired timeout in secondspublic int getVideoQuality()
setVideoQuality(int)public void setVideoQuality(int videoQuality)
setVideoQuality(360) SDK will try to show video with nearest size, so if ad has
ad video with 480x800 and 1920x1080 sizes, 480x800 will be used.
Default is 360videoQuality - desired quality in vertical pixels@Nullable public InstreamAdPlayer getPlayer()
InstreamAdPlayerpublic void setPlayer(@Nullable
InstreamAdPlayer player)
InstreamAdPlayer. Before playing, it must be set
player here, or use default player useDefaultPlayer()player - custom player implementationInstreamAdPlayerpublic void swapPlayer(@Nullable
InstreamAdPlayer player)
setPlayer(InstreamAdPlayer)player - another player to smooth switch with saving state of videopublic boolean isFullscreen()
public void setFullscreen(boolean fullscreen)
fullscreen - param is ad in fullscreen mode or notpublic float getVolume()
setVolume(float)public void setVolume(float volume)
volume - volume param in range [0,1]@NonNull public float[] getMidPoints()
configureMidpoints(float), or
configureMidpointsPercents(float, float[]) methods to get an
array of points based on the duration of the main video and points set by the application.public void load()
InstreamAd.InstreamAdListener.onLoad(InstreamAd) method will be called on the
object passed as a listener, in case of loading error or if there is no advertisement to be
shown - the InstreamAd.InstreamAdListener.onNoAd(String, InstreamAd)
Listener must be added before loadingsetListener(InstreamAdListener)public void configureMidpoints(float videoDuration)
videoDuration - duration of the video, where should be midpointspublic void configureMidpoints(float videoDuration,
@Nullable
float[] midpoints)
videoDuration - duration of the video, where should be midpointsmidpoints - an array with desired positionspublic void configureMidpointsPercents(float videoDuration,
@Nullable
float[] midpointsPercents)
videoDuration - duration of the video, where should be midpointsmidpointsPercents - an array with desired positions in percentspublic void useDefaultPlayer()
public void useDefaultPlayer(boolean useExoPlayer)
useExoPlayer - determines whether to use ExoPlayer or notpublic void pause()
public void resume()
public void stop()
public void skip()
public void skipBanner()
public void handleClick()
public void destroy()
public void startPreroll()
public void startPostroll()
public void startPauseroll()
public void startMidroll(float point)
getMidPoints()