com.brightcove.ima

## Class GoogleIMAComponent

- java.lang.Object
- - com.brightcove.player.event.AbstractComponent
  - - com.brightcove.ima.GoogleIMAComponent

- All Implemented Interfaces:
    Component, com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider

      @Emits(events={"adBreakCompleted","adCompleted","adError","adPaused","adProgress","adResumed","adBreakStarted","adStarted","completed","error","pause","play","willInterruptContent","willResumeContent","registerPlugin","setCuePoints","adsManagerLoaded","adsRequestForVideo","didFailToPlayAd","showSeekControls","hideSeekControls"})
       @ListensFor(events={"activityCreated","activityPaused","activityResumed","activitySaveInstanceState","activityStarted","activityDestroyed","completed","cuePoint","fragmentCreatedView","fragmentPaused","fragmentResumed","fragmentSaveInstanceState","fragmentStarted","fragmentDestroyed","play","progress","seekTo","willChangeVideo","videoDurationChanged","adsManagerLoaded","didFailToPlayAd","showMediaControls"})
      public class GoogleIMAComponent
      extends AbstractComponent
      implements com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener, com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener, com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener, com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `GoogleIMAComponent.Builder`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `AD_EVENT`
    `static java.lang.String` | `AD_PLAYHEAD_POSITION`
    `static java.lang.String` | `AD_TAG_URL`
    `static java.lang.String` | `AD_WAS_PLAYING`
    `static java.lang.String` | `ADS_MANAGER`
    `static java.lang.String` | `ADS_REQUESTS`

    - ### Fields inherited from class com.brightcove.player.event.AbstractComponent

      `eventEmitter, listenerTokens`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter)` Deprecated. Please use the `GoogleIMAComponent.Builder` instead
    `GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, boolean useAdRules)` Deprecated. Please use the `GoogleIMAComponent.Builder` instead
    `GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, boolean useAdRules, com.google.ads.interactivemedia.v3.api.AdsRenderingSettings adsRenderingSettings)` Deprecated. Please use the `GoogleIMAComponent.Builder` instead
    `GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, boolean useAdRules, com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)` Deprecated. Please use the `GoogleIMAComponent.Builder` instead
    `GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, boolean useAdRules, com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings, com.google.ads.interactivemedia.v3.api.AdsRenderingSettings adsRenderingSettings)` Deprecated. Please use the `GoogleIMAComponent.Builder` instead
    `GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)` Deprecated. Please use the `GoogleIMAComponent.Builder` instead

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCallback(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback callback)`
    `com.google.ads.interactivemedia.v3.api.AdDisplayContainer` | `getAdDisplayContainer()` Returns the current `AdDisplayContainer`, or null if it has not been created yet.
    `int` | `getAdPosition()`
    `int` | `getContentPosition()` Deprecated.
    `long` | `getContentPositionLong()`
    `com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate` | `getContentProgress()`
    `int` | `getCurrentAdIndex()`
    `java.util.List<com.google.ads.interactivemedia.v3.api.AdsRequest>` | `getCurrentAdsRequests()`
    `com.google.ads.interactivemedia.v3.api.ImaSdkSettings` | `getImaSdkSettings()`
    `GoogleIMAVideoAdPlayer` | `getVideoAdPlayer()` Returns the current `GoogleIMAVideoAdPlayer`, or null if it has not been created yet.
    `void` | `initializeAdsRequests()` Deprecated. It's no longer necessary to call this method. The initialization of Ad Rules happens automatically now.
    `boolean` | `isPlayingAd()`
    `void` | `onAdError(com.google.ads.interactivemedia.v3.api.AdErrorEvent event)`
    `void` | `onAdEvent(com.google.ads.interactivemedia.v3.api.AdEvent event)`
    `void` | `onAdsManagerLoaded(com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent event)`
    `void` | `onContentPauseRequested()`
    `void` | `onContentResumeRequested()`
    `void` | `reloadAdsRequest()` Creates a request to reload the Ads.
    `void` | `removeCallback(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback callback)`
    `void` | `setAdPosition(int adPosition)` Deprecated.
    `void` | `setAdPosition(long adPosition)`
    `void` | `setContentPosition(int position)` Deprecated.
    `void` | `setContentPosition(long position)`
    `void` | `skipCurrentAd()`
    `void` | `skipCurrentAds()`
    `void` | `updateAdTargetingValues(java.util.Map<java.lang.String,java.lang.String> adTargetingValues)` Updates the key/value pairs used for audience segment targeting.
    `void` | `useAdRules(boolean useAdRules)`

    - ### Methods inherited from class com.brightcove.player.event.AbstractComponent

      `addListener, addOnceListener, getEventEmitter, removeListener, removeListeners`

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

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

- - ### Field Detail

    - #### ADS_REQUESTS

          public static final java.lang.String ADS_REQUESTS

      See Also:
        Constant Field Values

    - #### AD_EVENT

          public static final java.lang.String AD_EVENT

      See Also:
        Constant Field Values

    - #### AD_TAG_URL

          public static final java.lang.String AD_TAG_URL

      See Also:
        Constant Field Values

    - #### ADS_MANAGER

          public static final java.lang.String ADS_MANAGER

      See Also:
        Constant Field Values

    - #### AD_PLAYHEAD_POSITION

          public static final java.lang.String AD_PLAYHEAD_POSITION

      See Also:
        Constant Field Values

    - #### AD_WAS_PLAYING

          public static final java.lang.String AD_WAS_PLAYING

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GoogleIMAComponent

          @Deprecated
          public GoogleIMAComponent(BaseVideoView baseVideoView,
                                                EventEmitter eventEmitter)

      Deprecated. Please use the `GoogleIMAComponent.Builder` instead
      Parameters:
        `baseVideoView` - The Brightcove video view.
        `eventEmitter` - The current event emitter.

    - #### GoogleIMAComponent

          @Deprecated
          public GoogleIMAComponent(BaseVideoView baseVideoView,
                                                EventEmitter eventEmitter,
                                                boolean useAdRules,
                                                com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings,
                                                com.google.ads.interactivemedia.v3.api.AdsRenderingSettings adsRenderingSettings)

      Deprecated. Please use the `GoogleIMAComponent.Builder` instead
      Parameters:
        `baseVideoView` - The Brightcove video view.
        `eventEmitter` - The current event emitter.
        `useAdRules` - Whether to use Ad Rules instead of cue points.
        `imaSdkSettings` - Application specified settings for the IMA SDK.
        `adsRenderingSettings` - AdsRenderingSettings used when initializing AdsManager.

    - #### GoogleIMAComponent

          @Deprecated
          public GoogleIMAComponent(BaseVideoView baseVideoView,
                                                EventEmitter eventEmitter,
                                                boolean useAdRules,
                                                com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)

      Deprecated. Please use the `GoogleIMAComponent.Builder` instead
      Parameters:
        `baseVideoView` - The Brightcove video view.
        `eventEmitter` - The current event emitter.
        `useAdRules` - Whether to use Ad Rules instead of cue points.
        `imaSdkSettings` - Application specified settings for the IMA SDK.

    - #### GoogleIMAComponent

          @Deprecated
          public GoogleIMAComponent(BaseVideoView baseVideoView,
                                                EventEmitter eventEmitter,
                                                boolean useAdRules,
                                                com.google.ads.interactivemedia.v3.api.AdsRenderingSettings adsRenderingSettings)

      Deprecated. Please use the `GoogleIMAComponent.Builder` instead
      Parameters:
        `baseVideoView` - The Brightcove video view.
        `eventEmitter` - The current event emitter.
        `useAdRules` - Whether to use Ad Rules instead of cue points.
        `adsRenderingSettings` - AdsRenderingSettings used when initializing AdsManager.

    - #### GoogleIMAComponent

          @Deprecated
          public GoogleIMAComponent(BaseVideoView baseVideoView,
                                                EventEmitter eventEmitter,
                                                boolean useAdRules)

      Deprecated. Please use the `GoogleIMAComponent.Builder` instead
      Parameters:
        `baseVideoView` - The Brightcove video view.
        `eventEmitter` - The current event emitter.
        `useAdRules` - Whether to use Ad Rules instead of cue points.

    - #### GoogleIMAComponent

          @Deprecated
          public GoogleIMAComponent(BaseVideoView baseVideoView,
                                                EventEmitter eventEmitter,
                                                com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)

      Deprecated. Please use the `GoogleIMAComponent.Builder` instead
      Parameters:
        `baseVideoView` - The Brightcove video view.
        `eventEmitter` - The current event emitter.
        `imaSdkSettings` - Application specified settings for the IMA SDK.

  - ### Method Detail

    - #### updateAdTargetingValues

          public void updateAdTargetingValues(@NonNull
                                              java.util.Map<java.lang.String,java.lang.String> adTargetingValues)

      Updates the key/value pairs used for audience segment targeting. These values will be appended to the Ad Tag Url as part of the "cust_param" query parameter. The "cust_param" values will be encoded. For example, if you provide the following map:

           Map<String, String> audienceSegmentTargetingValues = new HashMap<>();
           audienceSegmentTargetingValues.put("section", "sports");
           audienceSegmentTargetingValues.put("multi", "baseball,tennis");

      The following string will be appended to the provided Ad Tag Url:

      "&cust_params=section%3Dsports%26multi%3Dbaseball%2Ctennis"

    - #### getCurrentAdIndex

          public int getCurrentAdIndex()

    - #### getCurrentAdsRequests

          @NonNull
          public java.util.List<com.google.ads.interactivemedia.v3.api.AdsRequest> getCurrentAdsRequests()

    - #### getVideoAdPlayer

          @Nullable
          public GoogleIMAVideoAdPlayer getVideoAdPlayer()

      Returns the current `GoogleIMAVideoAdPlayer`, or null if it has not been created yet.

    - #### getAdDisplayContainer

          @Nullable
          public com.google.ads.interactivemedia.v3.api.AdDisplayContainer getAdDisplayContainer()

      Returns the current `AdDisplayContainer`, or null if it has not been created yet.

    - #### initializeAdsRequests

          @Deprecated
          public void initializeAdsRequests()

      Deprecated. It's no longer necessary to call this method. The initialization of Ad Rules happens automatically now.

    - #### getAdPosition

          public int getAdPosition()

    - #### setAdPosition

          @Deprecated
          public void setAdPosition(int adPosition)

      Deprecated.

    - #### setAdPosition

          public void setAdPosition(long adPosition)

    - #### getContentPosition

          @Deprecated
          public int getContentPosition()

      Deprecated.

    - #### getContentPositionLong

          public long getContentPositionLong()

    - #### setContentPosition

          @Deprecated
          public void setContentPosition(int position)

      Deprecated.

    - #### setContentPosition

          public void setContentPosition(long position)

    - #### skipCurrentAd

          public void skipCurrentAd()

    - #### isPlayingAd

          public boolean isPlayingAd()

    - #### reloadAdsRequest

          public void reloadAdsRequest()

      Creates a request to reload the Ads.

      This method will re-initialize the Ads Manager and will emit the GoogleIMAEventType.ADS_MANAGER_LOADED event again.

      NOTE: This method works only when the GoogleIMAComponent is NOT using Google Ad Rules.

    - #### skipCurrentAds

          public void skipCurrentAds()

    - #### onAdError

          public void onAdError(com.google.ads.interactivemedia.v3.api.AdErrorEvent event)

      Specified by:
        `onAdError` in interface `com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener`

    - #### addCallback

          public void addCallback(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback callback)

    - #### removeCallback

          public void removeCallback(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback callback)

    - #### onAdsManagerLoaded

          public void onAdsManagerLoaded(com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent event)

      Specified by:
        `onAdsManagerLoaded` in interface `com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener`

    - #### onAdEvent

          public void onAdEvent(com.google.ads.interactivemedia.v3.api.AdEvent event)

      Specified by:
        `onAdEvent` in interface `com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener`

    - #### onContentPauseRequested

          public void onContentPauseRequested()

    - #### onContentResumeRequested

          public void onContentResumeRequested()

    - #### useAdRules

          public void useAdRules(boolean useAdRules)

    - #### getImaSdkSettings

          public com.google.ads.interactivemedia.v3.api.ImaSdkSettings getImaSdkSettings()

    - #### getContentProgress

          public com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate getContentProgress()

      Specified by:
        `getContentProgress` in interface `com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider`