Reducing latency
The key to reducing latency in your IMA-enabled web page is to do as much
IMA-related setup 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 initializes the IMA SDK and request and parses 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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-06 UTC.
[null,null,["Last updated 2025-03-06 UTC."],[[["To minimize latency in IMA-enabled web pages, perform IMA setup tasks like creating `AdDisplayContainer`, `AdsLoader`, `AdsRequest`, requesting ads, and obtaining the `AdsManager` instance early in the page lifecycle."],["By initializing the IMA SDK and handling ad responses before user interaction, you ensure smoother ad playback when the user initiates it."],["Before playing ads, call `AdDisplayContainer.initialize()` (triggered by user action), followed by `AdsManager.init` and `AdsManager.start` to begin ad playback."],["For broader page performance enhancements, consult Chrome's network performance evaluation resources."]]],[]]