了解 SDK 架构
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南简要介绍了 SDK 生命周期和
IMA DAI SDK 与广告服务器之间建立连接。
基本互动
下图说明了并标注了
IMA DAI SDK 和 Ad Manager 360 集成。

网页或应用通过以下方式加载 IMA DAI SDK:
- 适用于 HTML5 的嵌入式脚本代码
- 适用于 Android、Google Cast、iOS、tvOS 或 Roku 的原生应用
IMA DAI SDK 通过 Google Ads 请求 VOD 视频流或直播视频流
Manager 360。
Ad Manager 360 会响应包含插入的广告插播时间点的视频串流。
IMA DAI SDK 解析响应,根据
提供视频流(以及
随播广告(如果需要的话)投放到网页或应用中。
视频播放器与 IMA DAI SDK 协商播放详细信息,然后播放广告。
IMA SDK 会根据需要触发展示 ping 和跟踪事件。
Lifecycle
下图显示了 IMA DAI SDK 的完整生命周期。构造函数和方法调用会以蓝色突出显示,事件会以红色突出显示,错误条件会显示为红色连接器和红色文本。

如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eThe IMA DAI SDK facilitates communication between your video player and an ad server (like Google Ad Manager 360) to seamlessly integrate ads into video content.\u003c/p\u003e\n"],["\u003cp\u003eThe SDK handles requesting the video stream, parsing ad breaks, and delivering the content to the player for playback, including companion ads.\u003c/p\u003e\n"],["\u003cp\u003eThroughout the process, the IMA SDK manages playback details, tracks ad impressions, and sends necessary event updates for monitoring and analysis.\u003c/p\u003e\n"],["\u003cp\u003eThe lifecycle of the SDK involves initialization, stream requests, ad playback, and event handling, with potential error scenarios addressed.\u003c/p\u003e\n"]]],[],null,["# Learn the SDK architecture\n\nThis guide provides an overview of the SDK lifecycle and the interactions\nbetween your video stream player, the IMA DAI SDK, and an ad server.\n\nBasic interactions\n------------------\n\nThe following diagram illustrates and annotates the interactions between\nyour video player, the IMA DAI SDK, and Ad Manager 360.\n\n1. The web page or app loads the IMA DAI SDK via:\n\n - an embedded script tag for HTML5\n - a native app for Android, Google Cast, iOS, tvOS, or Roku\n2. The IMA DAI SDK requests either a VOD stream or live stream from Google Ad\n Manager 360.\n\n3. Ad Manager 360 responds with the video stream that includes inserted ad\n breaks.\n\n4. The IMA DAI SDK parses the response, determines the correct media type based\n on environment, and delivers the video stream (and\n companion ads if needed) to the web page or app.\n\n5. The video player negotiates the playback details with the IMA DAI SDK and\n plays the ads.\n\n6. The IMA SDK fires an impression ping and tracking events, as needed.\n\nLifecycle\n---------\n\nThis diagram shows the full lifecycle of the IMA DAI SDK. Constructor and method\ncalls are highlighted in blue, events are highlighted in red, and error\nconditions are shown with red connectors and red text."]]