瞭解 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 和追蹤事件。
生命週期
下圖顯示 IMA DAI SDK 的完整生命週期。建構函式和方法
通話會以藍色醒目顯示,事件會以紅色醒目顯示,而錯誤
並用紅色連接號和紅色文字標示各項條件。

除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-21 (世界標準時間)。
[null,null,["上次更新時間: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."]]