Tìm hiểu cấu trúc SDK
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Hướng dẫn này cung cấp thông tin tổng quan về vòng đời của SDK và các hoạt động tương tác giữa trình phát video, SDK IMA và máy chủ quảng cáo.
Tương tác cơ bản
Sơ đồ sau đây minh hoạ và chú thích các hoạt động tương tác giữa trình phát video, IMA SDK và máy chủ quảng cáo. Máy chủ quảng cáo có thể sử dụng Ad Manager, AdSense cho Video (AFV) hoặc Ad Exchange (AdX).

Trang web hoặc ứng dụng tải SDK IMA bằng cách sử dụng:
- thẻ tập lệnh được nhúng cho HTML5
- một ứng dụng cho Android, Google Cast, iOS hoặc tvOS
IMA SDK yêu cầu Phản hồi VAST cho Đơn vị quảng cáo cụ thể trên máy chủ quảng cáo. Máy chủ quảng cáo được gọi (có thể là Ad Manager so với AFV hoặc AdX) được xác định bằng URL thẻ quảng cáo.
Máy chủ quảng cáo chọn quảng cáo phù hợp nhất và gửi phản hồi VAST đến SDK IMA.
Quảng cáo được chọn bằng một trong các phương thức sau:
- Bộ lọc Đơn vị quảng cáo của Ad Manager lọc các Mục hàng đề xuất
- AdSense hoặc Ad Exchange chạy một phiên đấu giá
SDK IMA phân tích cú pháp phản hồi VAST, xác định loại phương tiện phù hợp dựa trên môi trường và phân phối mẫu quảng cáo dạng video trong dòng (và quảng cáo đi kèm nếu cần) đến trang web hoặc ứng dụng.
Trình phát video thương lượng thông tin chi tiết về việc phát với IMA SDK và phát quảng cáo.
IMA SDK sẽ kích hoạt một ping hiển thị và các sự kiện theo dõi VAST (nếu cần).
Vòng đời
Sơ đồ này cho thấy toàn bộ vòng đời của SDK IMA. Hàm khởi tạo và lệnh gọi phương thức được đánh dấu bằng màu xanh dương, các sự kiện được đánh dấu bằng màu đỏ và các điều kiện lỗi được hiển thị bằng các trình kết nối màu đỏ và văn bản màu đỏ.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eThis guide explains the lifecycle of the Interactive Media Ads (IMA) SDK and how it facilitates communication between your video player, the SDK, and an ad server (Ad Manager, AdSense for Video, or Ad Exchange).\u003c/p\u003e\n"],["\u003cp\u003eThe process involves the IMA SDK requesting ads from the ad server based on the provided ad tag URL, the ad server selecting and sending a VAST response, and the SDK parsing this response to deliver ads to the video player.\u003c/p\u003e\n"],["\u003cp\u003eThe video player then handles ad playback while the IMA SDK manages tracking events like impressions and VAST events for reporting purposes.\u003c/p\u003e\n"],["\u003cp\u003eThis guide also visually illustrates the entire IMA SDK lifecycle including constructor calls, method calls, events, and potential errors.\u003c/p\u003e\n"]]],[],null,["Select platform: [HTML5](/interactive-media-ads/docs/sdks/html5/client-side/architecture \"View this page for the HTML5 platform docs.\") [Android](/interactive-media-ads/docs/sdks/android/client-side/architecture \"View this page for the Android platform docs.\") [iOS](/interactive-media-ads/docs/sdks/ios/client-side/architecture \"View this page for the iOS platform docs.\") [tvOS](/interactive-media-ads/docs/sdks/tvos/client-side/architecture \"View this page for the tvOS platform docs.\")\n\n\u003cbr /\u003e\n\nThis guide provides an overview of the SDK lifecycle and the interactions\nbetween your video player, the IMA SDK, and an ad server.\n\nBasic interactions\n\nThe following diagram illustrates and annotates the interactions between\nyour video player, the IMA SDK, and an ad server. The ad server can use\nAd Manager, AdSense for Video (AFV), or Ad Exchange (AdX).\n\n1. The web page or app loads the IMA SDK using:\n\n - an embedded script tag for HTML5\n - an app for Android, Google Cast, iOS, or tvOS\n2. The IMA SDK requests a VAST Response for the specific Ad Unit on the ad\n server. The ad server called, which can be either Ad Manager versus AFV or\n AdX, is determined by the ad tag URL.\n\n3. The ad server selects the best ad and sends a VAST response to the IMA SDK.\n Ads are selected using one of the following methods:\n\n - Ad Manager Ad Unit filters Line Item candidates\n - AdSense or Ad Exchange runs an auction\n4. The IMA SDK parses the VAST response, determines the correct media type based\n on environment, and delivers the inline video creative (and\n companion ads if needed) to the web page or app.\n\n5. The video player negotiates the playback details with the IMA SDK and plays\n the ads.\n\n6. The IMA SDK fires an impression ping and VAST tracking events, as needed.\n\nLifecycle\n\nThis diagram shows the full lifecycle of the IMA 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."]]