Today we're announcing
Beta 9 of the IMA Android SDK. This release includes important new API changes to support upcoming alternate IMA SDK ad playback. These changes will prevent your app from compiling so you'll need to make a few code updates using the following guide.
Required Changes
- Pause and resume ads with AdsManager
Previously, the SDK did not provide a method to pause/resume the current ad. Beta 9 of the SDK introduces AdsManager.pause() and AdsManager.resume() to control these events. You should no longer directly control the pause/play/resume of ads via your video player. Instead, use the AdsManager methods. In the future, the IMA SDK may play ads with a video player other than your content video player, so utilizing the AdsManager methods now will ensure that ad pause and resume calls are called on the appropriate player.
- Change getProgress() to getAdProgress()
The VideoAdPlayer.getProgress() signature has changed; it now explicitly states it's returning the progress of the current ad:
VideoProgressUpdate getAdProgress()
When implementing this method, return VideoProgressUpdate.VIDEO_TIME_NOT_READY if an ad is not playing (for example, if content is playing). Here's a sample getAdProgress method:
@Override
public VideoProgressUpdate getAdProgress() {
if (currentVideoIsAd() && currentVideo.getDuration() > 0) {
return new VideoProgressUpdate(
video.getCurrentPosition(), video.getDuration())
} else {
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
}
}
- Return content progress with ContentProgressProvider
For the SDK to automatically schedule ad breaks when ad rules (for DFP) or VMAP playlists are returned in an ad tag, your player should provide the playback progress of your content video. The ContentProgressProvider interface has been introduced to allow the SDK to check on actively playing content. Pass an implementation of ContentProgressProvider to your AdsRequest object via:
AdsRequest.setContentProgressProvider(ContentProgressProvider);
This method should return VideoProgressUpdate.VIDEO_TIME_NOT_READY if content is not playing (for example, if an ad is playing). Here's a sample ContentProgressProvider implementation:
@Override
public VideoProgressUpdate getContentProgress() {
if (currentVideoIsContent() && currentVideo.getDuration() > 0) {
return new VideoProgressUpdate(
video.getCurrentPosition(), video.getDuration());
} else {
return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
}
}
Why should I update to Beta 9?
In addition to bug fixes, Beta 9 of the SDK introduces important changes to clarify some API intentions and to, in a later release, allow the SDK to use an SDK-managed video player to play ads when it would improve the ad viewing experience for certain environments and ad types.
Beta 9 is an optional upgrade; new SDK integrations should use Beta 9 (check out our
quick start guide), but your existing apps can upgrade at your discretion. The API changes introduced in Beta 9 will carry over to later IMA Android SDK releases, so if you wish to minimize code changes when the next version of the IMA Android SDK is released, you can make these app code changes now.
Other changes in Beta 9
Download IMA Android SDK Beta 9
You can get this latest release of the IMA Android SDK from our
IMA SDK downloads page.
Other questions?
As always, feel free to drop us a line on the
IMA SDK forum and follow our
Google+ page for other announcements and updates.