public final class InstreamAudioAd extends BaseAd
| Modifier and Type | Class and Description |
|---|---|
static class |
InstreamAudioAd.InstreamAdCompanionBanner
Model for companion banner.
|
static class |
InstreamAudioAd.InstreamAudioAdBanner
Model for InStream audio banner
|
static interface |
InstreamAudioAd.InstreamAudioAdListener |
adConfig, metricFactory| Constructor and Description |
|---|
InstreamAudioAd(int slotId,
android.content.Context context)
Public constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
configureMidpoints(float audioDuration)
Sets the duration of the main audio.
|
void |
configureMidpoints(float audioDuration,
float[] midpoints)
Sets the duration of the main audio.
|
void |
configureMidpointsPercents(float audioDuration,
float[] midpointsPercents)
Allows you to set the duration of the main audio in seconds and an array of banner midroll
points in percent.
|
void |
destroy()
Destroys the ad and frees resources
|
InstreamAudioAd.InstreamAudioAdBanner |
getCurrentBanner()
Current playing banner available only after start playing and receiving
InstreamAudioAdListener#onBannerStart(InstreamAudioAd, InstreamAudioAdBanner)
callback |
InstreamAudioAd.InstreamAudioAdListener |
getListener()
Get events listener of an advertisement
|
int |
getLoadingTimeout() |
float[] |
getMidPoints()
Method for getting a list of points at which audio banners will be played.
|
InstreamAudioAdPlayer |
getPlayer()
Player was set to play audio ad.
|
float |
getVolume() |
void |
handleCompanionClick(InstreamAudioAd.InstreamAdCompanionBanner instreamAdCompanionBanner)
Opens companion's tracking link and click statistics with default app context.
|
void |
handleCompanionClick(InstreamAudioAd.InstreamAdCompanionBanner instreamAdCompanionBanner,
android.content.Context context)
Opens companion's tracking link and click statistics with context
|
void |
handleCompanionShow(InstreamAudioAd.InstreamAdCompanionBanner instreamAdCompanionBanner)
Calls show/impression statistics from companion banner
|
void |
load()
Start loading ads.
|
void |
pause()
Pauses ad audio
|
void |
resume()
Resumes ad audio from pause
|
void |
setListener(InstreamAudioAd.InstreamAudioAdListener 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(InstreamAudioAdPlayer player)
Sets custom implementation of
InstreamAudioAdPlayer. |
void |
setVolume(float volume)
Allows you to control the volume of audio playback and affects the sending of statistics of
sound changes.
|
void |
skip()
Explicitly ends playing current section/sequence of ad audios.
|
void |
skipBanner()
Explicitly ends playing current audio banner.
|
void |
startMidroll(float point)
Starts the "midroll" section of audio ad at point.
|
void |
startPauseroll()
Starts the "pauseroll" section of audio ad
|
void |
startPostroll()
Starts the "postroll" section of audio ad
|
void |
startPreroll()
Starts the "preroll" section of audio ad
|
void |
stop()
Stops ad audio
|
getCustomParams, isLoadCalledpublic InstreamAudioAd(int slotId,
@NonNull
android.content.Context context)
slotId - your slot idcontext - app context@Nullable public InstreamAudioAd.InstreamAudioAdListener getListener()
InstreamAudioAd.InstreamAudioAdListenerpublic void setListener(@Nullable
InstreamAudioAd.InstreamAudioAdListener listener)
load()InstreamAudioAd.InstreamAudioAdListenerpublic int getLoadingTimeout()
setLoadingTimeout(int)public void setLoadingTimeout(int loadingTimeout)
InstreamAudioAd.InstreamAudioAdListener.onNoAd(String, InstreamAudioAd) 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 seconds@Nullable public InstreamAudioAdPlayer getPlayer()
InstreamAudioAdPlayerpublic void setPlayer(@Nullable
InstreamAudioAdPlayer player)
InstreamAudioAdPlayer. Before playing, it must be set
player here.player - custom player implementationInstreamAudioAdPlayerpublic 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 audio and points set by the application.@Nullable public InstreamAudioAd.InstreamAudioAdBanner getCurrentBanner()
InstreamAudioAdListener#onBannerStart(InstreamAudioAd, InstreamAudioAdBanner)
callbackpublic void load()
InstreamAudioAd.InstreamAudioAdListener.onLoad(InstreamAudioAd) 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 InstreamAudioAd.InstreamAudioAdListener.onNoAd(String, InstreamAudioAd)
Listener must be added before loadingsetListener(InstreamAudioAdListener)public void configureMidpoints(float audioDuration)
audioDuration - duration of the audio, where should be midpointspublic void configureMidpoints(float audioDuration,
@Nullable
float[] midpoints)
audioDuration - duration of the audio, where should be midpointsmidpoints - an array with desired positionspublic void configureMidpointsPercents(float audioDuration,
@Nullable
float[] midpointsPercents)
audioDuration - duration of the audio, where should be midpointsmidpointsPercents - an array with desired positions in percentspublic void pause()
public void resume()
public void stop()
public void skip()
public void skipBanner()
public void destroy()
public void startPreroll()
public void startPostroll()
public void startPauseroll()
public void startMidroll(float point)
getMidPoints()public void handleCompanionClick(@NonNull
InstreamAudioAd.InstreamAdCompanionBanner instreamAdCompanionBanner)
handleCompanionClick(InstreamAdCompanionBanner, Context)instreamAdCompanionBanner - clicked companionInstreamAudioAd.InstreamAdCompanionBannerpublic void handleCompanionClick(@NonNull
InstreamAudioAd.InstreamAdCompanionBanner instreamAdCompanionBanner,
@NonNull
android.content.Context context)
instreamAdCompanionBanner - clicked companioncontext - context to handle intentInstreamAudioAd.InstreamAdCompanionBannerpublic void handleCompanionShow(@NonNull
InstreamAudioAd.InstreamAdCompanionBanner instreamAdCompanionBanner)
instreamAdCompanionBanner - showing companionInstreamAudioAd.InstreamAdCompanionBanner