Package com.google.android.exoplayer2.ext.ima

## Class ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

- java.lang.Object
- - com.google.android.exoplayer2.ext.ima.ImaServerSideAdInsertionMediaSource.AdsLoader.Builder

- Enclosing class:
    ImaServerSideAdInsertionMediaSource.AdsLoader

      public static final class ImaServerSideAdInsertionMediaSource.AdsLoader.Builder
      extends Object

  Builder for building an `ImaServerSideAdInsertionMediaSource.AdsLoader`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder​(Context context, AdViewProvider adViewProvider)` | Creates an instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ImaServerSideAdInsertionMediaSource.AdsLoader` | `build()` | Returns a new `ImaServerSideAdInsertionMediaSource.AdsLoader`.
    `ImaServerSideAdInsertionMediaSource.AdsLoader.Builder` | `setAdErrorListener​(com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener adErrorListener)` | Sets the optional `AdErrorEvent.AdErrorListener` that will be passed to `BaseManager.addAdErrorListener(AdErrorEvent.AdErrorListener)`.
    `ImaServerSideAdInsertionMediaSource.AdsLoader.Builder` | `setAdEventListener​(com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener adEventListener)` | Sets the optional `AdEvent.AdEventListener` that will be passed to `BaseManager.addAdEventListener(AdEventListener)`.
    `ImaServerSideAdInsertionMediaSource.AdsLoader.Builder` | `setAdsLoaderState​(ImaServerSideAdInsertionMediaSource.AdsLoader.State state)` | Sets the optional state to resume with.
    `ImaServerSideAdInsertionMediaSource.AdsLoader.Builder` | `setCompanionAdSlots​(Collection<com.google.ads.interactivemedia.v3.api.CompanionAdSlot> companionAdSlots)` | Sets the slots to use for companion ads, if they are present in the loaded ad.
    `ImaServerSideAdInsertionMediaSource.AdsLoader.Builder` | `setFocusSkipButtonWhenAvailable​(boolean focusSkipButtonWhenAvailable)` | Sets whether to focus the skip button (when available) on Android TV devices.
    `ImaServerSideAdInsertionMediaSource.AdsLoader.Builder` | `setImaSdkSettings​(com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)` | Sets the IMA SDK settings.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Builder

          public Builder​(Context context,
                         AdViewProvider adViewProvider)

      Creates an instance.
      Parameters:
        `context` - A context.
        `adViewProvider` - A provider for `ViewGroup` instances.

  - ### Method Detail

    - #### setImaSdkSettings

          @CanIgnoreReturnValue
          public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setImaSdkSettings​(com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)

      Sets the IMA SDK settings.

      If this method is not called, the default settings will be used with the language set to the preferred system language.

      Parameters:
        `imaSdkSettings` - The `ImaSdkSettings`.
      Returns:
        This builder, for convenience.

    - #### setAdEventListener

          @CanIgnoreReturnValue
          public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setAdEventListener​(com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener adEventListener)

      Sets the optional `AdEvent.AdEventListener` that will be passed to `BaseManager.addAdEventListener(AdEventListener)`.
      Parameters:
        `adEventListener` - The ad event listener.
      Returns:
        This builder, for convenience.

    - #### setAdErrorListener

          @CanIgnoreReturnValue
          public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setAdErrorListener​(com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener adErrorListener)

      Sets the optional `AdErrorEvent.AdErrorListener` that will be passed to `BaseManager.addAdErrorListener(AdErrorEvent.AdErrorListener)`.
      Parameters:
        `adErrorListener` - The `AdErrorEvent.AdErrorListener`.
      Returns:
        This builder, for convenience.

    - #### setCompanionAdSlots

          @CanIgnoreReturnValue
          public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setCompanionAdSlots​(Collection<com.google.ads.interactivemedia.v3.api.CompanionAdSlot> companionAdSlots)

      Sets the slots to use for companion ads, if they are present in the loaded ad.
      Parameters:
        `companionAdSlots` - The slots to use for companion ads.
      Returns:
        This builder, for convenience.
      See Also:
        `BaseDisplayContainer.setCompanionSlots(Collection)`

    - #### setAdsLoaderState

          @CanIgnoreReturnValue
          public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setAdsLoaderState​(ImaServerSideAdInsertionMediaSource.AdsLoader.State state)

      Sets the optional state to resume with.

      The state can be received when `releasing` the `ImaServerSideAdInsertionMediaSource.AdsLoader`.

      Parameters:
        `state` - The state to resume with.
      Returns:
        This builder, for convenience.

    - #### setFocusSkipButtonWhenAvailable

          @CanIgnoreReturnValue
          public ImaServerSideAdInsertionMediaSource.AdsLoader.Builder setFocusSkipButtonWhenAvailable​(boolean focusSkipButtonWhenAvailable)

      Sets whether to focus the skip button (when available) on Android TV devices. The default setting is `true`.
      Parameters:
        `focusSkipButtonWhenAvailable` - Whether to focus the skip button (when available) on Android TV devices.
      Returns:
        This builder, for convenience.
      See Also:
        `AdsRenderingSettings.setFocusSkipButtonWhenAvailable(boolean)`

    - #### build

          public ImaServerSideAdInsertionMediaSource.AdsLoader build()

      Returns a new `ImaServerSideAdInsertionMediaSource.AdsLoader`.