Package com.castlabs.sdk.ima

# Class ImaAdRequest

java.lang.Object
com.castlabs.sdk.ima.ImaAdRequest

public final class ImaAdRequest extends Object
IMA request implementation allowing to issue IMA Ad requests.

After `ImaPlugin` is registered and enabled the request can be issued as following:

      // Starting playback with a Bundle
      Bundle bundle = new Bundle();
      bundle.putParcelable(SdkConsts.INTENT_ADVERTS_DATA, new ImaAdRequest("ima_url").toAdRequest())

      // Starting playback with PlayerConfig
      PlayerConfig config = new PlayerConfig.Builder("content_url")
        .adRequest(new ImaAdRequest("url").toAdRequest())
             .get();

Since:
  3.2.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `ImaAdRequest.Builder`
  Builder for `ImaAdRequest`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final long`
  `adPreloadTimeoutMs`
  The ad preload timeout in milliseconds.
  `static final int`
  `DEFAULT_AD_LOAD_TIMEOUT_MS`
  Default timeout to AD Media
  `static final Double`
  `DEFAULT_PLAY_ADS_AFTER_TIME_SEC`
  Optional play-ads-after content time in seconds.
  `static final int`
  `DEFAULT_STALL_AD_TIMEOUT_MS`
  Default timeout to consider the ad playback stalled and switch to the main content playback
  `static final int`
  `DEFAULT_VAST_LOAD_TIMEOUT_MS`
  Default timeout to load VAST files
  `static final boolean`
  `DISABLE_IMA_AD_UI`
  Disable Default IMA UI
  `final boolean`
  `disableDefaultAdUi`
  Flag to disable the default ad UI rendered by IMA.
  `final int`
  `maxMediaBitrate`
  The max media bitrate.
  `final int`
  `mediaLoadTimeoutMs`
  The ad media load timeout in milliseconds.
  `final boolean`
  `playAdBeforeStartPosition`
  Whether to play an ad before the start position.
  `final Double`
  `playAdsAfterTimeSec`
  Optional play-ads-after content time in seconds.
  `static final long`
  `SCHEDULE_DELAY_DEFAULT_MS`
  Default time offset that will be added to the current position when manually scheduling ads
  `static final long`
  `SCHEDULE_DELAY_MAXIMUM_MS`
  Maximum value for `scheduleDelayMs`
  `final long`
  `scheduleDelayMs`
  Time offset that will be added to the current position when manually scheduling ads.
  `final int`
  `stallAdTimeoutMs`
  Timeout in ms to consider the ad playback stalled and switch to the main content playback
  `final String`
  `tagUrl`
  Ad tag Url
  `final int`
  `vastLoadTimeoutMs`
  The VAST load timeout in milliseconds.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ImaAdRequest(String tagUrl)`
  Deprecated.
  use `ImaAdRequest.Builder` instead.
  `ImaAdRequest(String tagUrl, int stallAdTimeoutMs)`
  Deprecated.
  Use `ImaAdRequest.Builder` instead.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `int`
  `hashCode()`
  `AdRequest`
  `toAdRequest()`
  Converts this `ImaAdRequest` to an `AdRequest`.

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_STALL_AD_TIMEOUT_MS

    public static final int DEFAULT_STALL_AD_TIMEOUT_MS
    Default timeout to consider the ad playback stalled and switch to the main content playback
    See Also:
      - Constant Field Values

  - ### SCHEDULE_DELAY_DEFAULT_MS

    public static final long SCHEDULE_DELAY_DEFAULT_MS
    Default time offset that will be added to the current position when manually scheduling ads
    See Also:
      - Constant Field Values

  - ### DEFAULT_PLAY_ADS_AFTER_TIME_SEC

    public static final Double DEFAULT_PLAY_ADS_AFTER_TIME_SEC
    Optional play-ads-after content time in seconds. Default is `null` which means all ads will be played.

  - ### DISABLE_IMA_AD_UI

    public static final boolean DISABLE_IMA_AD_UI
    Disable Default IMA UI
    See Also:
      - Constant Field Values

  - ### SCHEDULE_DELAY_MAXIMUM_MS

    public static final long SCHEDULE_DELAY_MAXIMUM_MS
    Maximum value for `scheduleDelayMs`
    See Also:
      - Constant Field Values

  - ### DEFAULT_VAST_LOAD_TIMEOUT_MS

    public static final int DEFAULT_VAST_LOAD_TIMEOUT_MS
    Default timeout to load VAST files
    See Also:
      - Constant Field Values

  - ### DEFAULT_AD_LOAD_TIMEOUT_MS

    public static final int DEFAULT_AD_LOAD_TIMEOUT_MS
    Default timeout to AD Media
    See Also:
      - Constant Field Values

  - ### tagUrl

    @Nullable public final String tagUrl
    Ad tag Url

  - ### stallAdTimeoutMs

    public final int stallAdTimeoutMs
    Timeout in ms to consider the ad playback stalled and switch to the main content playback

  - ### scheduleDelayMs

    public final long scheduleDelayMs
    Time offset that will be added to the current position when manually scheduling ads.

  - ### playAdsAfterTimeSec

    @Nullable public final Double playAdsAfterTimeSec
    Optional play-ads-after content time in seconds.

  - ### disableDefaultAdUi

    public final boolean disableDefaultAdUi
    Flag to disable the default ad UI rendered by IMA.

  - ### adPreloadTimeoutMs

    public final long adPreloadTimeoutMs
    The ad preload timeout in milliseconds.

  - ### vastLoadTimeoutMs

    public final int vastLoadTimeoutMs
    The VAST load timeout in milliseconds.

  - ### mediaLoadTimeoutMs

    public final int mediaLoadTimeoutMs
    The ad media load timeout in milliseconds.

  - ### maxMediaBitrate

    public final int maxMediaBitrate
    The max media bitrate.

  - ### playAdBeforeStartPosition

    public final boolean playAdBeforeStartPosition
    Whether to play an ad before the start position. The default setting is `true`.

- ## Constructor Details

  - ### ImaAdRequest

    public ImaAdRequest(@Nullable String tagUrl)
    Deprecated.
    use `ImaAdRequest.Builder` instead.
    Create Ima Ad request with specified tag Url.
    Parameters:
      `tagUrl` - Ad tag Url

  - ### ImaAdRequest

    public ImaAdRequest(@Nullable String tagUrl, int stallAdTimeoutMs)
    Deprecated.
    Use `ImaAdRequest.Builder` instead.
    Create Ima Ad request with specified tag Url.
    Parameters:
      `tagUrl` - Ad tag Url
      `stallAdTimeoutMs` - Set to non-zero value to enable workaround for stalled ad playbacks and switch to the main content playback after the specified timeout. Set to `-1` to disable the workaround

- ## Method Details

  - ### toAdRequest

    @NonNull public AdRequest toAdRequest()
    Converts this `ImaAdRequest` to an `AdRequest`.
    Returns:
      The converted `AdRequest`.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(@Nullable Object obj)
    Overrides:
      `equals` in class `Object`