Class ExoAdPlayer

  • All Implemented Interfaces:
    AdPlayer<AdAsset>, Component

    @ListensFor(events={"activityPaused","activityResumed","fragmentPaused","fragmentResumed","adBreakStarted","adBreakCompleted"})
    @Emits(events={"adBreakStarted","adStarted","adCompleted","adBreakCompleted","adResumed","adPaused","adProgress","adError","willInterruptContent","willResumeContent","play"})
    public final class ExoAdPlayer
    extends AbstractComponent
    implements AdPlayer<AdAsset>
    Implementation of an AdPlayer using ExoPlayer. ExoAdPlayer handles AdAsset as the type of Ads to be played.
    • Method Detail

      • create

        public static ExoAdPlayer create​(@NonNull
                                         BaseVideoView baseVideoView)
        Creates an ExoAdPlayer and adds a PlayerView in the BaseVideoView. Note: This method must be called from the UI thread.
        Parameters:
        baseVideoView - where the Ad will be rendered.
        Returns:
        a new instance of an ExoAdPlayer.
      • create

        public static ExoAdPlayer create​(@NonNull
                                         BaseVideoView baseVideoView,
                                         @Nullable
                                         AdPlayer.AdPlayerSettings adPlayerSettings)
        Creates an ExoAdPlayer and adds a PlayerView in the BaseVideoView. Note: This method must be called from the UI thread.
        Parameters:
        baseVideoView - where the Ad will be rendered.
        adPlayerSettings - configuration object for the ad player
        Returns:
        a new instance of an ExoAdPlayer.
      • create

        public static ExoAdPlayer create​(@NonNull
                                         android.view.ViewGroup viewGroup,
                                         @NonNull
                                         EventEmitter eventEmitter,
                                         @Nullable
                                         AdPlayer.AdPlayerSettings adPlayerSettings)
        Creates an ExoAdPlayer and adds a PlayerView in the provided ViewGroup. Note: This method must be called from the UI thread.
        Parameters:
        viewGroup - where the Ad will be rendered.
        eventEmitter - the event emitter
        adPlayerSettings - configuration object for the ad player
        Returns:
        a new instance of an ExoAdPlayer.
      • loadAd

        public void loadAd​(@NonNull
                           AdAsset adAsset)
        Description copied from interface: AdPlayer
        Loads an ad of type T.
        Specified by:
        loadAd in interface AdPlayer<AdAsset>
        Parameters:
        adAsset - ad to be loaded.
      • seekTo

        public void seekTo​(long position)
        Description copied from interface: AdPlayer
        Seeks to the specified position.
        Specified by:
        seekTo in interface AdPlayer<AdAsset>
      • skipAd

        public void skipAd()
        Description copied from interface: AdPlayer
        Skips the current ad.
        Specified by:
        skipAd in interface AdPlayer<AdAsset>
      • stop

        public void stop()