The key to reducing latency in your IMA-enabled app is to do as much IMA-related setup as early as possible. Do the following in your app before playing ads:
- Define a content playhead tracker.
- Create an
IMAAdsLoader
. If you have an existingIMAAdsLoader
instance, re-use it to reduce latency and ensure that features like frequency capping work properly. - Create an
IMAAdDisplayContainer
. - Create the
IMAAdsRequest
. - Request ads.
- Instantiate an
IMAAdsManager
instance. - Create your
IMAAdsRenderingSettings
.
These steps initialize the IMA SDK, request ads, and parse the ad
response—all before the user even clicks play on your video.
When you're ready to play the ads, initialize the IMAAdsManager
via
IMAAdsManager:initializeWithAdsRenderingSettings
and call
start
.