Additional Google IMA (Android v3)


Custom Parameters

Use the AdBreak object to customize your IMA ad request.

Map<String, String> customParams = new HashMap<>();
customParams.put("age", "18");
customParams.put("gender", "male");

AdBreak adBreak = new AdBreak("pre", AdSource.IMA, "{your_tag}");
adBreak.setCustomParams(customParams);

Alternatively, you can use the adschedule object to customize your IMA request.

"adschedule": {
    "adBreak1": {
        "offset": "pre",
        "custParams" : {
            "age" : "18",
            "gender" : "male"
        },
        "ad": {
            "source": "googima",
            "tag": "{your_tag}"
        }
    }
}


VMAP Advertising

Currently, VMAP advertising schedules can only be assigned to the entire playlist by using our VMAPAdvertising object. The added benefit of using VMAP is the fact that it contains its own ad schedule which can be easily served across different platforms.

// Create a new ImaVMAPAdvertising
ImaVMAPAdvertising imaVMAPAdvertising = new ImaVMAPAdvertising("https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpostpod&cmsid=496&vid=short_onecue&correlator=");

// Construct a PlaylistItem
PlaylistItem video = new PlaylistItem("http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8");

// Add the PlaylistItem to a List 
List<PlaylistItem> playlist = new ArrayList<>();
playlist.add(video);

// Build the PlayerConfig
PlayerConfig playerConfig = new PlayerConfig.Builder()
							.playlist(playlist)
							.advertising(imaVMAPAdvertising)
							.build();

// Setup the player
mPlayerView.setup(playerConfig);


Ad Pods

Ad Pods allow ad networks to deliver multiple ads within a single ad break.

// Create video
PlaylistItem video = new PlaylistItem("http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8");

// Set the ad break offset and tag
AdBreak adBreak = new AdBreak("pre", AdSource.IMA, "http://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=sample_ar%3Dpreonlybumper&cmsid=496&vid=short_onecue&correlator=");
List<AdBreak> adSchedule = new ArrayList<>();
adSchedule.add(adBreak);

// Set the ad schedule to your video
video.setAdSchedule(adSchedule);

// Add the PlaylistItem to a List 
List<PlaylistItem> playlist = new ArrayList<>();
playlist.add(video);

// Build the PlayerConfig
PlayerConfig playerConfig = new PlayerConfig.Builder()
							.playlist(playlist)
							.build();

// Setup the player
mPlayerView.setup(playerConfig);

IMA SDK Settings

As of version 2.6.x of the JW Player SDK for Android, settings for the IMA SDK can be configured by creating a new instance of ImaSdkSettings. Developers can then assigning it to an ImaAdvertising or ImaVMAPAdvertising instance by calling setImaSdkSetting() or by passing it into the constructor.

For more information on the ImaSdkSettings class and its features please refer to the official Google documentation:

https://developers.google.com/interactive-media-ads/docs/sdks/android/v3/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkSettings

// Create two videos with separate ad schedules
List<AdBreak> adSchedule = new ArrayList<>();
AdBreak adBreak = new AdBreak("pre", AdSource.IMA, "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=");
adSchedule.add(adBreak);
PlaylistItem video = new PlaylistItem("http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8");
video.setAdSchedule(adSchedule);

List<AdBreak> adSchedule2 = new ArrayList<>();
AdBreak adBreak2 = new AdBreak("pre", AdSource.IMA, "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=");
adSchedule2.add(adBreak2);
PlaylistItem video2 = new PlaylistItem("http://playertest.longtailvideo.com/jwpromo/jwpromo.m3u8");
video2.setAdSchedule(adSchedule2);

// Add your videos to a playlist
List<PlaylistItem> playlist = new ArrayList<>();
playlist.add(video);
playlist.add(video2);

// Setup the IMA SDK Settings and localize the advertising UI
ImaSdkSettings imaSdkSettings = ImaSdkFactory.getInstance().createImaSdkSettings();
imaSdkSettings.setLanguage("nl");


// Set an empty List<AdBreak> to ImaAdvertising
// This will allow the imaSdkSettings to take effect while having playlist item specific ad schedules
// You could set the ad schedule to the ImaAdvertising object if you want the same schedule for each item
ImaAdvertising imaAdvertising = new ImaAdvertising(new ArrayList<AdBreak>(), imaSdkSettings);


// Create your player config
PlayerConfig playerConfig = new PlayerConfig.Builder()
		.playlist(playlist)
		.advertising(imaAdvertising)
		.build();

// Setup your player with the config
mPlayerView.setup(playerConfig);


Unsupported Features

Ad tag waterfalls

When using AdSource.IMA you do not have the ability to define an ad tag waterfall in your code. An ad tag waterfall analog is instead defined in your Google Dashboard.

Non-linear Overlay Ads

Non-linear ads are not currently supported via AdSource.IMA. This is a limitation of the Google IMA SDK for Android. For more information please refer to the documentation here:

https://developers.google.com/interactive-media-ads/docs/sdks/android/compatibility

Ad skip offset

The ad skip offset is always set within the ad response of a Google IMA ad tag and we do not override the value. To configure your skip offset please contact your ad network.

Ad tag variables

The ad tag variables specified in our VAST documentation are not supported when using AdSource.IMA. Instead, we suggest contacting Google IMA to provide you with a list of ad tag variables supported in the Google IMA SDK.

VPAID

The Google IMA SDK does not support VPAID 1.0 or VPAID 2.0 ads. This is a limitation of the Google IMA SDK for Android. For more information please refer to the documentation here:

https://developers.google.com/interactive-media-ads/docs/sdks/android/compatibility