andrewlewis 07de4d1b2c Handle ad skipping and content resume
SKIPPED can't be handled as CONTENT_RESUME_REQUESTED because after skipping an
ad there may be further ads to play in its ad group.

Remove workaround for handling unexpected playAd without stopAd, as the player
can instead recover when IMA sends CONTENT_RESUME_REQUESTED. This in turn fixes
handling of the case where playAd is called twice but IMA expects only the
first ad to play, when skipping a particular ad. (Add an ad tag where this
occurs to internal samples.)

Check whether a currently playing ad has been marked as played in
ExoPlayerImplInternal, and handle this case as a seek. This ensures that any
loaded ad periods are discarded in the case of CONTENT_RESUME_REQUESTED.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162610621
2017-07-21 11:23:10 +01:00
..
2017-07-12 18:23:11 +01:00

ExoPlayer IMA extension

Description

The IMA extension is a MediaSource implementation wrapping the Interactive Media Ads SDK for Android. You can use it to insert ads alongside content.

Getting the extension

The easiest way to use the extension is to add it as a gradle dependency:

compile 'com.google.android.exoplayer:extension-ima:rX.X.X'

where rX.X.X is the version, which must match the version of the ExoPlayer library being used.

Alternatively, you can clone the ExoPlayer repository and depend on the module locally. Instructions for doing this can be found in ExoPlayer's top level README.

Using the extension

Pass a single-window content MediaSource to ImaAdsMediaSource's constructor, along with a ViewGroup that is on top of the player and the ad tag URI to show. The IMA documentation includes some sample ad tags for testing. Then pass the ImaAdsMediaSource to ExoPlayer.prepare.

You can try the IMA extension in the ExoPlayer demo app. To do this you must select and build one of the withExtensions build variants of the demo app in Android Studio. You can find IMA test content in the "IMA sample ad tags" section of the app.

Known issues

This is a preview version with some known issues:

  • Tapping the 'More info' button on an ad in the demo app will pause the activity, which destroys the ImaAdsMediaSource. Played ad breaks will be shown to the user again if the demo app returns to the foreground.
  • Ad loading timeouts are currently propagated as player errors, rather than being silently handled by resuming content.