跳到主要内容
哒哒星球DADA PLANET

Skill · 已公开版本

ima-sdk-client-side · IMA SDK 客户端视频广告接入

指导在网站、应用、电视等平台用 Google IMA SDK 请求 VAST/VMAP 视频与音频广告并管理播放,不适用于 DAI、SSAI 或 SGAI。

先看看示例

作者提供的示例,实际效果取决于你的输入和使用工具。

输入

在网页播放器中接入 IMA,初始化后发起广告请求,监听加载成功取得 AdsManager 并协调内容暂停。

输出

预期交付:按平台指南实现的广告加载、播放事件处理与资源清理代码。(编辑说明,非实际运行结果)

方法说明

---
name: ima-sdk-client-side
description: >-
  Supports Interactive Media Ads (IMA) SDK.
  Use this skill for client-side ad insertion when you are requesting video ads
  for websites, apps, TVs or other platforms using VAST or VMAP.
  Do not use for Dynamic Ad Insertion (DAI), SSAI, or SGAI.
license: Apache-2.0
metadata:
  author: Google LLC
  version: "1.0.2"
  category: GoogleAds
---
# IMA SDK client-side

The Google IMA SDK (Interactive Media Ads) lets you load in-stream video and
audio ads into websites, apps, TVs and other digital platforms. Use an IMA SDK
to request ads from any VAST-compliant ad server and manage ad playback.

## Prerequisites

Before integrating the IMA SDK, you **must** read the platform-specific guide
below to support all platforms that your app can support:

*   **Web/HTML5/ReactJs/NodeJs/Angular:** Read all these guides
    [ima-sdk-web-guide.md](references/ima-sdk-web-guide.md),
    [ima-sdk-web-iframe-mode.md](references/ima-sdk-web-iframe-mode.md),
    [ima-sdk-web-mobile-safari.md](references/ima-sdk-web-mobile-safari.md)
*   **Android/AndroidTV/ReactNative:** Read [ima-sdk-android-guide.md](references/ima-sdk-android-guide.md)
*   **iOS/tvOS/ReactNative:** Read all these guides
    [ima-sdk-ios-guide.md](references/ima-sdk-ios-guide.md),
    [ima-sdk-tvos-guide.md](references/ima-sdk-tvos-guide.md)

--------------------------------------------------------------------------------

## Quick start (general workflow)

1.  Import the SDK: Prerequisites, dependencies.
2.  Initialization: Early setup, Warmup, Settings Configuration, and Ad UI
    Setup.
3.  Ad Request: Creating and triggering the request, User gesture compliance.
4.  Ad Load Success/Failure: Handling the load event to get the AdsManager, or
    handling early fatal errors.
5.  Ad Playback Events: Listening to playback events via AdsManager to
    coordinate content play/pause, and handling non-fatal LOG events and fatal
    active playback errors.
6.  Cleanup: Properly destroying the AdsManager to release resources and prevent
    memory leaks.

For detailed, platform-specific implementation details, always refer to the
guides in the Prerequisites section.