Class HlsInterstitialAdLoader

java.lang.Object
com.castlabs.android.adverts.HlsInterstitialAdLoader
All Implemented Interfaces:
AdLoader

public class HlsInterstitialAdLoader extends Object implements AdLoader
  • Constructor Details

    • HlsInterstitialAdLoader

      public HlsInterstitialAdLoader()
  • Method Details

    • getCurrentAd

      @Nullable public Ad getCurrentAd()
      Description copied from interface: AdLoader
      Get the currently loaded and prepared for playing Ad
      Specified by:
      getCurrentAd in interface AdLoader
      Returns:
      The current Ad or null
    • getAdContainer

      @Nullable public ViewGroup getAdContainer()
      Description copied from interface: AdLoader
      Returns ad UI container
      Specified by:
      getAdContainer in interface AdLoader
      Returns:
      ad UI container
    • setPlayerController

      public void setPlayerController(@Nullable PlayerController playerController)
      Description copied from interface: AdLoader
      Set the active PlayerController instance or null if there is no active PlayerController or it is about to be released
      Specified by:
      setPlayerController in interface AdLoader
      Parameters:
      playerController - The PlayerController instance or null
    • release

      public void release()
      Description copied from interface: AdLoader
      Release any unused resources
      Specified by:
      release in interface AdLoader
    • createMediaSource

      public void createMediaSource(@NonNull PlayerConfig playerConfig, @NonNull PlayerPlugin playerPlugin, @NonNull AdLoader.Listener listener)
      Description copied from interface: AdLoader
      Asynchronously create MediaSource to play
      Specified by:
      createMediaSource in interface AdLoader
      Parameters:
      playerConfig - The PlayerConfig
      playerPlugin - The PlayerPlugin
      listener - The listener callback to provide the created MediaSource
    • onSetPosition

      public long onSetPosition(long newPositionUs)
      Description copied from interface: AdLoader
      Called just before the PlayerController start seeking or setting a new position. Can be used when the new position has to be adjusted by the AdLoader implementation e.g. to do ads snap back. If the adjustment is not needed then the provided position can simply be returned.
      Specified by:
      onSetPosition in interface AdLoader
      Parameters:
      newPositionUs - The new position in microseconds
      Returns:
      The adjusted position in microseconds
    • onPlayerStateChanged

      public void onPlayerStateChanged(boolean playWhenReady, int playbackState)
      Description copied from interface: AdLoader
      Called when the player state is changed
      Specified by:
      onPlayerStateChanged in interface AdLoader
      Parameters:
      playWhenReady - Play when ready flag
      playbackState - Playback state
    • onPositionDiscontinuity

      public void onPositionDiscontinuity(int reason)
      Description copied from interface: AdLoader
      Called when the playback discontinuity occurs
      Specified by:
      onPositionDiscontinuity in interface AdLoader
      Parameters:
      reason - The reason for discontinuity
    • scheduleAd

      public void scheduleAd(@NonNull AdRequest adRequest)
      Description copied from interface: AdLoader
      Start loading an AdRequest. This may be also called during playback. Support for on-request ad scheduling depends on the AdLoader implementation.
      Specified by:
      scheduleAd in interface AdLoader
      Parameters:
      adRequest - The ad request to perform.
    • getAdApi

      @Nullable public AdApi getAdApi()
      Description copied from interface: AdLoader
      Get an AdApi to issue custom operations to the ad provider
      Specified by:
      getAdApi in interface AdLoader
      Returns:
      the AdApi
    • maybeWrapMediaSource

      public com.google.android.exoplayer2.source.MediaSource maybeWrapMediaSource(com.google.android.exoplayer2.source.MediaSource mediaSource, PlayerConfig playerConfig)
      Specified by:
      maybeWrapMediaSource in interface AdLoader