Thông tin sản phẩm

Migrating to Brightcove’s IMA Plugin 6.15.0

In this topic, you will learn how to migrate your app to use Brightcove’s IMA plugin for the Native SDK for Android 6.15.0.

Bạn đang xem: Migrating to Brightcove’s IMA Plugin 6.15.0


The Brightcove Native SDK for Android 6.15.0 or later supports the Google IMA SDK version 3.19.4. If you are using IMA advertising, there are a few things to be aware of to use this version of the IMA plugin. They include the following:

  • Changes in the Google IMA SDK

  • Changes in the Brightcove IMA plugin

  • Migrating to the IMA Plugin 6.15.0

Xem thêm: Váy Hàn Quốc đẹp nhất cho những cô nàng bánh bèo

Changes in the Google IMA SDK

The Brightcove Native SDK updated the Google IMA SDK from version 3.11.2 to version 3.19.4. The most relevant changes include:

  • SdkFactory.createAdDisplayContainer() is deprecated
  • AdDisplayContainer.setPlayer(VideoAdPlayer) is deprecated
  • AdDisplayContainer.setAdContainer(ViewGroup) is deprecated
  • AdsRequest.setAdDisplayContainer(AdDisplayContainer) is removed

For the full release, see the

Google IMA Android SDK release history


Xem thêm: Phương pháp giặt khô thảm văn phòng hiệu quả tối ưu tại Đà Nẵng

Changes in the Brightcove IMA plugin

The Brightcove IMA plugin made several changes to be fully compatible with the new Google IMA SDK version. They include:

  • Using the GoogleIMAComponent Builder

  • Creating the AdDisplayContainer

  • Deprecated methods in GoogleIMAVideoAdPlayer

Using the GoogleIMAComponent Builder

We recommend using the Builder to create the GoogleIMAComponent instance. This makes it easier to configure the GoogleIMAComponent.

googleIMAComponent = new GoogleIMAComponent.Builder(brightcoveVideoView, eventEmitter) .setUseAdRules(true) .setImaSdkSettings(customIMASDKSettings) .setAdsRenderingSettings(customAdsRenderingSettings) .setAdDisplayContainerFactory(customAdDisplayContainerFactory) .build(); }

Creating the AdDisplayContainer

Because the Google IMA SDK removed AdsRequest.setAdDisplayContainer(...), the Brightcove IMA plugin now creates this automatically, using the GoogleIMAVideoAdPlayer and the BaseVideoView.

The plugin requires an AdDisplayContainerFactory to create the AdDisplayContainer.

public interface AdDisplayContainerFactory { /** * Creates the AdDisplayContainer with the provided GoogleIMAVideoAdPlayer * and the ViewGroup retrieved with getViewContainer() * * @param googleIMAVideoAdPlayer the Brightcove Ad Player for Google IMA */ AdDisplayContainer createAdDisplayContainer(GoogleIMAVideoAdPlayer googleIMAVideoAdPlayer); /** * Returns the ViewGroup container used for both, * the creation of the GoogleIMAVideoAdPlayer and the AdDisplayContainer */ ViewGroup getViewContainer(); } 

Under the hood, the plugin uses the DefaultAdDisplayContainerFactory, an AdDisplayContainerFactory, to create the AdDisplayContainer. The getViewContainer() returns the BaseVideoView passed in its constructor, and the createAdDisplayContainer method returns:

ImaSdkFactory.createAdDisplayContainer(getViewContainer(), googleIMAVideoAdPlayer);

Add your AdDisplayContainerFactory

If you need a different implementation, you must pass your own AdDisplayContainerFactory to the GoogleIMAComponent Builder:

googleIMAComponent = new GoogleIMAComponent.Builder(brightcoveVideoView, eventEmitter) .setAdDisplayContainerFactory(customAdDisplayContainerFactory) .build(); 

If you want to play the Ads in a different view other than the BaseVideoView, you can provide the DefaultAdDisplayContainerFactory with your ViewGroup.

googleIMAComponent = new GoogleIMAComponent.Builder(brightcoveVideoView, eventEmitter) .setAdDisplayContainerFactory(new DefaultAdDisplayContainerFactory(myViewGroup)) .build(); 

Deprecated methods in GoogleIMAVideoAdPlayer

The following methods are deprecated in the GoogleIMAVideoAdPlayer class:



Deprecated Deprecated method Use instead
playAd() playAd(AdMediaInfo)
loadAd(String) loadAd(AdMediaInfo, AdPodInfo)
stopAd() stopAd(AdMediaInfo)
resumeAd() playAd(AdMediaInfo)
pauseAd() pauseAd(AdMediaInfo)

Notice that the replacement methods now require AdMediaInfo. You can retrieve the current AdMediaInfo object by calling GoogleIMAVideoAdPlayer.getCurrentAdMediaInfo(). This will return the loaded AdMediaInfo, or Null.

Xem thêm: Title: Section 5-6.15-Bulk water

Migrating to the IMA Plugin 6.15.0

To migrate to the Brightcove IMA Plugin 6.15.0, follow steps:

  • Update dependency versions

  • Remove deprecated methods

Update dependency versions

Update your app to use the following dependency versions:

  • All of the Brightcove SDK dependencies set to version 6.15.0
  • Use Google IMA SDK version 3.19.4
  • Use Google Play Services version 19.2.0

Here is an example of the build.gradle file:

//build.gradle dependencies { //Brightcove SDK dependencies implementation "com.brightcove.player:android-sdk6.15.0:" implementation "com.brightcove.player:exoplayer2:6.15.0" implementation "com.brightcove.player:android-ima-plugin:6.15.0" //Google IMA SDK implementation "" //Google Play Services implementation "" ... } 

Remove deprecated methods

Your current Google IMA setup might look similar to this:

AdDisplayContainer container = sdkFactory.createAdDisplayContainer(); container.setPlayer(googleIMAComponent.getVideoAdPlayer()); container.setAdContainer(brightcoveVideoView); 

These three methods are deprecated and will go away.

You must now call googleIMAComponent.getAdDisplayContainer() and it will return the AdDisplayContainer associated with the GoogleIMAVideoAdPlayer, or null if not available.

For details about creating the AdDisplayContainer, see the

Creating the AdDisplayContainer


The following method has also been removed from the Google IMA SDK:


Instead, use the AdDisplayContainer to create an instance of the Google IMA AdsLoader.

For details about deprecated methods and their replacements, see the

Deprecated methods in GoogleIMAVideoAdPlayer


More information

For more details about IMA changes, see the

Google IMA Android SDK release history


For any related questions, feel free to reach out to the Brightcove SDK team through the

Brightcove SDK forum


Chuyên mục: Thông tin sản phẩm

Related Articles

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Back to top button
444 liveapp 444 live444 live app