Package com.castlabs.android.adverts

# Interface AdInterface.Listener

Enclosing interface:
  `AdInterface`

public static interface AdInterface.Listener
Listener for ad events.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onAdClicked(String clickthroughUrl)`
  Fired when the ad is clicked
  `void`
  `onAdCompleted()`
  This callback is fired right after the Ad playback has finished.
  `void`
  `onAdError(Ad ad, CastlabsPlayerException exception)`
  This callback is fired if there is an error on loading or during the Ad playback.
  `void`
  `onAdPaused()`
  Fired when playback is paused while playing an ad
  `void`
  `onAdPlaybackPositionChanged(long playbackPositionMs)`
  Event triggered when the Ad playback position changed.
  `void`
  `onAdResumed(Ad ad)`
  Fired when playback is resumed while playing an ad
  `void`
  `onAdSkipped()`
  This callback is fired if the user skip the Ad
  `void`
  `onAdStarted(Ad ad)`
  This callback is fired right before the Ad is about to start playing.
  `void`
  `onAdWillStart(Ad ad)`
  This callback is fired when the Ad begins loading.

- ## Method Details

  - ### onAdWillStart

    void onAdWillStart(@NonNull Ad ad)
    This callback is fired when the Ad begins loading.
    Parameters:
      `ad` - The Ad object. Notice that in this level, some properties of the ad such as `Ad.title` might be null.

  - ### onAdStarted

    void onAdStarted(@NonNull Ad ad)
    This callback is fired right before the Ad is about to start playing. Usually the content player controls should be hidden and turned into disabled state.
    Parameters:
      `ad` - The Ad object

  - ### onAdCompleted

    void onAdCompleted()
    This callback is fired right after the Ad playback has finished. Usually the content player controls should become visible and enabled.

  - ### onAdError

    void onAdError(Ad ad, CastlabsPlayerException exception)
    This callback is fired if there is an error on loading or during the Ad playback.
    Parameters:
      `ad` - The Ad object
      `exception` - The error's exception

  - ### onAdSkipped

    void onAdSkipped()
    This callback is fired if the user skip the Ad

  - ### onAdPlaybackPositionChanged

    void onAdPlaybackPositionChanged(long playbackPositionMs)
    Event triggered when the Ad playback position changed. Note that for performance reasons, this is triggered at most once per second, hence you will only see when seconds changing during playback.
    Parameters:
      `playbackPositionMs` - the current Ad playback position in milliseconds

  - ### onAdPaused

    void onAdPaused()
    Fired when playback is paused while playing an ad

  - ### onAdResumed

    void onAdResumed(Ad ad)
    Fired when playback is resumed while playing an ad
    Parameters:
      `ad` - The Ad object

  - ### onAdClicked

    void onAdClicked(String clickthroughUrl)
    Fired when the ad is clicked
    Parameters:
      `clickthroughUrl` - The clickthrough URL of the ad