Reducing Latency

The key to reducing latency in your IMA-enabled web page is to do as much IMA-related set up as early as possible. You can do all of the following on your web page as early as you like before playing ads:

  • Create your AdDisplayContainer.
  • Create your AdsLoader.
  • Create your AdsRequest.
  • Request ads.
  • Obtain your AdsManager instance and register event handlers.
Doing all of the above will initialize the IMA SDK and request and parse your ads response all before the user even clicks play on your video. When you're ready to play the ads, call AdDisplayContainer.initialize() (always as the result of a user action!), then call AdsManager.init and AdsManager.start. For more information on making your entire page more responsive, see the tips on evaluating network performance in the Chrome documentation.