-
- All Implemented Interfaces:
-
com.google.android.exoplayer2.source.ads.AdsLoader
@MainThread() public class YandexAdsLoader implements 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 public final static StringAD_TAG_URI
-
Constructor Summary
Constructors Constructor Description YandexAdsLoader(Context context, InstreamAdRequestConfiguration requestConfiguration)
-
Method Summary
Modifier and Type Method Description voidrequestAds(@Nullable() ViewGroup adViewGroup)Requests ads, if they have not already been requested. voidsetVideoAdPlaybackListener(@Nullable() VideoAdPlaybackListener listener)Sets listener for single video ad creative playback events. voidsetPlayer(@Nullable() Player player)voidrelease()voidsetSupportedContentTypes(@C.ContentType() Array<int> contentTypes)voidstart(@Nullable() AdsMediaSource adsMediaSource, @Nullable() DataSpec adTagDataSpec, @Nullable() Object adPlaybackId, @Nullable() AdViewProvider adViewProvider, @Nullable() AdsLoader.EventListener eventListener)voidstop(@Nullable() AdsMediaSource adsMediaSource, @Nullable() AdsLoader.EventListener eventListener)voidhandlePrepareComplete(@Nullable() AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup)voidhandlePrepareError(@Nullable() AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup, @Nullable() IOException exception)-
-
Constructor Detail
-
YandexAdsLoader
YandexAdsLoader(Context context, InstreamAdRequestConfiguration requestConfiguration)
-
-
Method Detail
-
requestAds
void requestAds(@Nullable() 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- A ViewGroup on top of the player that will show any ad UI.
-
setVideoAdPlaybackListener
void setVideoAdPlaybackListener(@Nullable() VideoAdPlaybackListener listener)
Sets listener for single video ad creative playback events.
- Parameters:
listener- A VideoAdPlaybackListener that will be triggered on video events.
-
release
void release()
-
setSupportedContentTypes
void setSupportedContentTypes(@C.ContentType() Array<int> contentTypes)
-
start
void start(@Nullable() AdsMediaSource adsMediaSource, @Nullable() DataSpec adTagDataSpec, @Nullable() Object adPlaybackId, @Nullable() AdViewProvider adViewProvider, @Nullable() AdsLoader.EventListener eventListener)
-
stop
void stop(@Nullable() AdsMediaSource adsMediaSource, @Nullable() AdsLoader.EventListener eventListener)
-
handlePrepareComplete
void handlePrepareComplete(@Nullable() AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup)
-
handlePrepareError
void handlePrepareError(@Nullable() AdsMediaSource adsMediaSource, int adGroupIndex, int adIndexInAdGroup, @Nullable() IOException exception)
-
-
-
-