Class 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
    • 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()
      • 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
      • setSpringServeMacrosMap

        public void setSpringServeMacrosMap​(java.util.HashMap<java.lang.String,​java.lang.Object> springServeMacros)
      • 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