Setting up Companion Ads
With the IMA integration, the Bitmovin Player also supports Companion Ads.
Companion Ads provide additional ways to deliver your message to your viewers and increase their engagement. They are typically banners or text ads that display alongside the video content.
Here's a quick guide on how to set up companion ads using the Bitmovin Android SDK.
Step 1: Create a CompanionAdContainer
A CompanionAdContainer
represents a placeholder where a companion ad will be displayed.
val companionAdContainer1 = CompanionAdContainer(companionAdSlot1, CompanionSize(300, 250))
val companionAdContainer2 = CompanionAdContainer(companionAdSlot2, CompanionSize(728, 90))
Replace companionAdSlot1
and companionAdSlot2
with the actual view containers in your layout where you want the ads to appear. CompanionSize
sets the width and height of the ad.
Step 2: Add the CompanionAdContainers to the AdvertisingConfig
In this step, you'll add the CompanionAdContainer
instances to the AdvertisingConfig
.
val advertisingConfig = AdvertisingConfig(
// ...
companionAdContainers = listOf(companionAdContainer1, companionAdContainer2),
)
Step 3: Continue as in the Basic Setup
From here, you'll proceed with the player setup as in the basic tutorial.
Conclusion
That's it! Companion ads will now display in the specified CompanionAdContainer
views during ad breaks. As always, consult the Bitmovin Android SDK API reference for more detailed information.
Remember that for Companion Ads to work properly, your ad tag (the URL you provide in the AdSource
) must include companion ads. This is typically configured on your ad server. The Bitmovin Player does not generate companion ads itself; it simply displays them if they are included in the ad tag.
Updated 8 months ago