@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
Modifier and Type | Class and Description |
---|---|
static class |
GoogleIMAComponent.Builder |
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 |
eventEmitter, listenerTokens
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 |
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() |
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) |
void |
setContentPosition(int 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) |
addListener, addOnceListener, getEventEmitter, removeListener, removeListeners
public static final java.lang.String ADS_REQUESTS
public static final java.lang.String AD_EVENT
public static final java.lang.String AD_TAG_URL
public static final java.lang.String ADS_MANAGER
public static final java.lang.String AD_PLAYHEAD_POSITION
public static final java.lang.String AD_WAS_PLAYING
@Deprecated public GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter)
GoogleIMAComponent.Builder
insteadbaseVideoView
- The Brightcove video view.eventEmitter
- The current event emitter.@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)
GoogleIMAComponent.Builder
insteadbaseVideoView
- 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.@Deprecated public GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, boolean useAdRules, com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)
GoogleIMAComponent.Builder
insteadbaseVideoView
- 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.@Deprecated public GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, boolean useAdRules, com.google.ads.interactivemedia.v3.api.AdsRenderingSettings adsRenderingSettings)
GoogleIMAComponent.Builder
insteadbaseVideoView
- 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.@Deprecated public GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, boolean useAdRules)
GoogleIMAComponent.Builder
insteadbaseVideoView
- The Brightcove video view.eventEmitter
- The current event emitter.useAdRules
- Whether to use Ad Rules instead of cue points.@Deprecated public GoogleIMAComponent(BaseVideoView baseVideoView, EventEmitter eventEmitter, com.google.ads.interactivemedia.v3.api.ImaSdkSettings imaSdkSettings)
GoogleIMAComponent.Builder
insteadbaseVideoView
- The Brightcove video view.eventEmitter
- The current event emitter.imaSdkSettings
- Application specified settings for the IMA SDK.public void updateAdTargetingValues(@NonNull java.util.Map<java.lang.String,java.lang.String> adTargetingValues)
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"
public int getCurrentAdIndex()
@NonNull public java.util.List<com.google.ads.interactivemedia.v3.api.AdsRequest> getCurrentAdsRequests()
@Nullable public GoogleIMAVideoAdPlayer getVideoAdPlayer()
GoogleIMAVideoAdPlayer
, or null if it has not been created yet.@Nullable public com.google.ads.interactivemedia.v3.api.AdDisplayContainer getAdDisplayContainer()
AdDisplayContainer
, or null if it has not been created yet.@Deprecated public void initializeAdsRequests()
public int getAdPosition()
public void setAdPosition(int adPosition)
public int getContentPosition()
public void setContentPosition(int position)
public void skipCurrentAd()
public boolean isPlayingAd()
public void reloadAdsRequest()
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.
public void skipCurrentAds()
public void onAdError(com.google.ads.interactivemedia.v3.api.AdErrorEvent event)
onAdError
in interface com.google.ads.interactivemedia.v3.api.AdErrorEvent.AdErrorListener
public void addCallback(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback callback)
public void removeCallback(com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback callback)
public void onAdsManagerLoaded(com.google.ads.interactivemedia.v3.api.AdsManagerLoadedEvent event)
onAdsManagerLoaded
in interface com.google.ads.interactivemedia.v3.api.AdsLoader.AdsLoadedListener
public void onAdEvent(com.google.ads.interactivemedia.v3.api.AdEvent event)
onAdEvent
in interface com.google.ads.interactivemedia.v3.api.AdEvent.AdEventListener
public void onContentPauseRequested()
public void onContentResumeRequested()
public void useAdRules(boolean useAdRules)
public com.google.ads.interactivemedia.v3.api.ImaSdkSettings getImaSdkSettings()
public com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate getContentProgress()
getContentProgress
in interface com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider