降低延时
若要缩短启用 IMA 的应用中的延迟时间,关键是尽早完成尽可能多的 IMA 相关设置。在播放广告之前,请在应用中执行以下操作:
- 定义内容播放头跟踪器。
- 创建
IMAAdsLoader
。如果您已有 IMAAdsLoader
实例,请重复使用该实例以缩短延迟时间,并确保频次上限等功能正常运行。
- 创建
IMAAdDisplayContainer
。
- 创建
IMAAdsRequest
。
- 请求广告。
- 实例化
IMAAdsManager
实例。
- 创建
IMAAdsRenderingSettings
。
这些步骤会在用户点击视频播放按钮之前初始化 IMA SDK、请求广告并解析广告响应。准备好播放广告后,请通过 IMAAdsManager:initializeWithAdsRenderingSettings
初始化 IMAAdsManager
并调用 start
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-07。
[null,null,["最后更新时间 (UTC):2025-03-07。"],[[["To minimize latency in IMA-enabled apps, perform IMA setup tasks like defining a playhead tracker, creating an `IMAAdsLoader`, `IMAAdDisplayContainer`, and `IMAAdsRequest`, and requesting ads before the user initiates playback."],["By completing these steps in advance, the IMA SDK is initialized, ads are requested, and the ad response is parsed, reducing delays when the user starts the video."],["Reuse existing `IMAAdsLoader` instances to further reduce latency and ensure optimal functionality of features like frequency capping."],["When ready for ad playback, initialize the `IMAAdsManager` and start it to seamlessly integrate ads into the user experience."]]],[]]