Class YandexAdsLoader
- java.lang.Object
-
- com.yandex.mobile.ads.instream.exoplayer.YandexAdsLoader
-
- All Implemented Interfaces:
com.google.android.exoplayer2.source.ads.AdsLoader
@MainThread public class YandexAdsLoader extends java.lang.Object implements com.google.android.exoplayer2.source.ads.AdsLoader
This class is implementation of ExoPlayer's AdsLoader interface. It can be used for simplified integration of Yandex Instream Ads to Exoplayer. Note that all methods of this class must be called on main thread.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
AD_TAG_URI
-
Constructor Summary
Constructors Constructor Description YandexAdsLoader(android.content.Context context, InstreamAdRequestConfiguration requestConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handlePrepareComplete(com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup)
void
handlePrepareError(com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup, java.io.IOException exception)
void
release()
void
requestAds(android.view.ViewGroup adViewGroup)
Requests ads, if they have not already been requested.void
setPlayer(com.google.android.exoplayer2.Player player)
void
setSupportedContentTypes(@com.google.android.exoplayer2.C.ContentType int... contentTypes)
void
setVideoAdPlaybackListener(com.yandex.mobile.ads.video.playback.VideoAdPlaybackListener listener)
Sets listener for single video ad creative playback events.void
start(com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, com.google.android.exoplayer2.upstream.DataSpec adTagDataSpec, java.lang.Object adPlaybackId, com.google.android.exoplayer2.ui.AdViewProvider adViewProvider, com.google.android.exoplayer2.source.ads.AdsLoader.EventListener eventListener)
void
stop(com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, com.google.android.exoplayer2.source.ads.AdsLoader.EventListener eventListener)
-
-
-
Field Detail
-
AD_TAG_URI
public static final java.lang.String AD_TAG_URI
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
YandexAdsLoader
public YandexAdsLoader(@NonNull android.content.Context context, @NonNull InstreamAdRequestConfiguration requestConfiguration)
-
-
Method Detail
-
requestAds
public void requestAds(@Nullable android.view.ViewGroup adViewGroup)
Requests ads, if they have not already been requested. Ads will be requested automatically when the player is prepared if this method has not been called, so it is only necessary to call this method if you want to request ads before preparing the player.- Parameters:
adViewGroup
- AViewGroup
on top of the player that will show any ad UI.
-
setVideoAdPlaybackListener
public void setVideoAdPlaybackListener(@Nullable com.yandex.mobile.ads.video.playback.VideoAdPlaybackListener listener)
Sets listener for single video ad creative playback events.- Parameters:
listener
- AVideoAdPlaybackListener
that will be triggered on video events.
-
setPlayer
public void setPlayer(@Nullable com.google.android.exoplayer2.Player player)
- Specified by:
setPlayer
in interfacecom.google.android.exoplayer2.source.ads.AdsLoader
-
release
public void release()
- Specified by:
release
in interfacecom.google.android.exoplayer2.source.ads.AdsLoader
-
setSupportedContentTypes
public void setSupportedContentTypes(@ContentType @com.google.android.exoplayer2.C.ContentType int... contentTypes)
- Specified by:
setSupportedContentTypes
in interfacecom.google.android.exoplayer2.source.ads.AdsLoader
-
start
public void start(@Nullable com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, @Nullable com.google.android.exoplayer2.upstream.DataSpec adTagDataSpec, @Nullable java.lang.Object adPlaybackId, @Nullable com.google.android.exoplayer2.ui.AdViewProvider adViewProvider, @Nullable com.google.android.exoplayer2.source.ads.AdsLoader.EventListener eventListener)
- Specified by:
start
in interfacecom.google.android.exoplayer2.source.ads.AdsLoader
-
stop
public void stop(@Nullable com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, @Nullable com.google.android.exoplayer2.source.ads.AdsLoader.EventListener eventListener)
- Specified by:
stop
in interfacecom.google.android.exoplayer2.source.ads.AdsLoader
-
handlePrepareComplete
public void handlePrepareComplete(@Nullable com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup)
- Specified by:
handlePrepareComplete
in interfacecom.google.android.exoplayer2.source.ads.AdsLoader
-
handlePrepareError
public void handlePrepareError(@Nullable com.google.android.exoplayer2.source.ads.AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup, @Nullable java.io.IOException exception)
- Specified by:
handlePrepareError
in interfacecom.google.android.exoplayer2.source.ads.AdsLoader
-
-