Overview
The Brightcove Native SDKs for Android and iOS support using the Open Measurement SDK (OM SDK). The OM SDK, integrated with the Google IMA, allows you to use third-party tools for ad measurement and verification.
The Open Measurement SDK considers all views overlaying the ad media element to be obstructions and reduces ad viewability. Video controls may be considered "friendly" obstructions, but must be registered with the OM SDK to be excluded from ad viewability measurement.
iOS
The Brightcove Native SDK for iOS supports using the OM SDK. For more information about implementing third-party ad measurement, see the Open Measurement in the IMA SDK for iOS document.
UI overlays
If you are using UI control elements which overlay the IMA ad view, then you'll want to register these with the OM SDK. For details, including how to get the ad display container from the ad sequence, see the Registering Ad Overlays section of the Native SDK for iOS reference.
IMA settings
By default, the Brightcove Native SDK for iOS sets the playerType and playerVersion properties with the following values:
imaSettings.playerType = @"bcov/ios-sdk-player";
imaSettings.playerVersion = [BCOVIMAComponent versionIdentifier];
You may want to override these values. One example would be to get advertising metrics reported directly from Google IMA. To use your own values, set the following on the imaSettings object:
imaSettings.playerType = @"your-player-type";
imaSettings.playerVersion = @"your-player-version";
For code details about using IMA ads with the Native SDK for iOS, see the BasicIMAPlayer sample.
Android
The Brightcove Native SDK for Android supports using the OM SDK. For more information about implementing third-party ad measurement, see the Open Measurement in the IMA SDK for Android document.
UI overlays
Register UI controls that overlay the IMA ad view as friendly obstructions. Use the ad display container from your IMA component, not a separate container. The following fragment extends the IMA sample's request handler; it does not replace the code that builds and responds with an ad request.
public class MainActivity extends BrightcovePlayer {
// ...
private AdDisplayContainer adDisplayContainer;
private View adOverlayView;
// ...
@Override
protected void onCreate(Bundle savedInstanceState) {
// ...
adOverlayView = findViewById(R.id.ad_overlay);
setupGoogleIMA();
// ...
}
private void setupGoogleIMA() {
// Show adOverlayView
eventEmitter.on(EventType.AD_BREAK_STARTED, (event) -> {
adOverlayView.setVisibility(View.VISIBLE);
});
// Hide adOverlayView
eventEmitter.on(EventType.AD_BREAK_COMPLETED, (event) -> {
adOverlayView.setVisibility(View.GONE);
});
// Create ImaSdkFactory
final ImaSdkFactory sdkFactory = ImaSdkFactory.getInstance();
eventEmitter.on(GoogleIMAEventType.ADS_REQUEST_FOR_VIDEO, event -> {
// Use the container created by the IMA component for this request.
adDisplayContainer = googleIMAComponent.getAdDisplayContainer();
if (adDisplayContainer != null) {
adDisplayContainer.registerFriendlyObstruction(
sdkFactory.createFriendlyObstruction(
adOverlayView,
FriendlyObstructionPurpose.VIDEO_CONTROLS,
"Video controls overlay"));
}
// ... Continue the ADS_REQUEST_FOR_VIDEO handler from the IMA sample.
});
eventEmitter.on(EventType.COMPLETED, event -> {
if (adDisplayContainer != null) {
adDisplayContainer.unregisterAllFriendlyObstructions();
}
});
}
}
IMA settings
By default, the Brightcove Native SDK for Android sets the playerType and playerVersion properties. The player type is bcov/and-sdk-player, and the player version is the current Native SDK version:
imaSdkSettings.setPlayerType("bcov/and-sdk-player");
imaSdkSettings.setPlayerVersion("<current SDK version>");
You may want to override these values. One example would be to get advertising metrics reported directly from Google IMA. To use your own values, set the following on the imaSdkSettings object:
ImaSdkSettings imaSdkSettings = imaSdkFactory.createImaSdkSettings();
imaSdkSettings.setPlayerType("your-player-type");
imaSdkSettings.setPlayerVersion("your-player-version");
GoogleIMAComponent googleIMAComponent = new GoogleIMAComponent(brightcoveVideoView, eventEmitter, imaSdkSettings);
For code details about using IMA ads with the Native SDK for Android, see the AdRulesIMASampleApp sample.