@ListensFor(events={"activityPaused","activityResumed","fragmentPaused","fragmentResumed","adBreakStarted","adBreakCompleted"}) @Emits(events={"adBreakStarted","adStarted","adCompleted","adBreakCompleted","adResumed","adPaused","adProgress","willInterruptContent","willResumeContent","play"}) public final class ExoAdPlayer extends AbstractComponent implements AdPlayer<AdAsset>
AdPlayer.AdPlayerSettings, AdPlayer.Listener<T>
eventEmitter, listenerTokens
Modifier and Type | Method and Description |
---|---|
void |
addListener(AdPlayer.Listener<AdAsset> listener)
Adds a
AdPlayer.Listener . |
static ExoAdPlayer |
create(BaseVideoView baseVideoView)
Creates an ExoAdPlayer and adds a PlayerView in the BaseVideoView.
|
static ExoAdPlayer |
create(BaseVideoView baseVideoView,
AdPlayer.AdPlayerSettings adPlayerSettings)
Creates an ExoAdPlayer and adds a PlayerView in the BaseVideoView.
|
static ExoAdPlayer |
create(android.view.ViewGroup viewGroup,
EventEmitter eventEmitter,
AdPlayer.AdPlayerSettings adPlayerSettings)
Creates an ExoAdPlayer and adds a PlayerView in the provided
ViewGroup . |
void |
loadAd(AdAsset adAsset)
Loads an ad of type T.
|
void |
pauseAd()
Pauses an ad.
|
void |
playAd()
Plays an ad.
|
void |
release()
Releases the
AdPlayer . |
void |
removeListener(AdPlayer.Listener<AdAsset> listener)
Removes a
AdPlayer.Listener . |
void |
seekTo(long position)
Seeks to the specified position.
|
void |
skipAd()
Skips the current ad.
|
void |
stop() |
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
public static ExoAdPlayer create(@NonNull BaseVideoView baseVideoView)
baseVideoView
- where the Ad will be rendered.public static ExoAdPlayer create(@NonNull BaseVideoView baseVideoView, @Nullable AdPlayer.AdPlayerSettings adPlayerSettings)
baseVideoView
- where the Ad will be rendered.adPlayerSettings
- configuration object for the ad playerpublic static ExoAdPlayer create(@NonNull android.view.ViewGroup viewGroup, @NonNull EventEmitter eventEmitter, @Nullable AdPlayer.AdPlayerSettings adPlayerSettings)
ViewGroup
.
Note: This method must be called from the UI thread.viewGroup
- where the Ad will be rendered.eventEmitter
- the event emitteradPlayerSettings
- configuration object for the ad playerpublic void loadAd(@NonNull AdAsset adAsset)
AdPlayer
public void addListener(@NonNull AdPlayer.Listener<AdAsset> listener)
AdPlayer
AdPlayer.Listener
.addListener
in interface AdPlayer<AdAsset>
listener
- listener to be added.public void removeListener(@NonNull AdPlayer.Listener<AdAsset> listener)
AdPlayer
AdPlayer.Listener
.removeListener
in interface AdPlayer<AdAsset>
listener
- listener to be removed.public void playAd()
AdPlayer
public void pauseAd()
AdPlayer
public void seekTo(long position)
AdPlayer
public void skipAd()
AdPlayer
public void stop()