ima-sdk-basics

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

IMA SDK basics

IMA SDK 基础内容

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.
Google IMA SDK(Interactive Media Ads)可帮助你将流式视频和音频广告加载到网站、应用、电视及其他数字平台中。你可以使用IMA SDK从任何兼容VAST的广告服务器请求广告,并管理广告播放。

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, ima-sdk-web-iframe-mode.md, ima-sdk-web-mobile-safari.md
  • Android/AndroidTV/ReactNative: Read ima-sdk-android-guide.md
  • iOS/tvOS/ReactNative: Read all these guides ima-sdk-ios-guide.md, ima-sdk-tvos-guide.md

在集成IMA SDK之前,你必须阅读以下特定平台指南,以支持你的应用所能覆盖的所有平台:
  • Web/HTML5/ReactJs/NodeJs/Angular: 阅读所有以下指南 ima-sdk-web-guide.mdima-sdk-web-iframe-mode.mdima-sdk-web-mobile-safari.md
  • Android/AndroidTV/ReactNative: 阅读 ima-sdk-android-guide.md
  • iOS/tvOS/ReactNative: 阅读所有以下指南 ima-sdk-ios-guide.mdima-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.
  1. 导入SDK:确认前置条件、依赖项。
  2. 初始化:早期配置、预热、设置配置以及广告UI搭建。
  3. 广告请求:创建并触发请求,确保符合用户交互要求。
  4. 广告加载成功/失败:处理加载事件以获取AdsManager,或处理早期致命错误。
  5. 广告播放事件:通过AdsManager监听播放事件,协调内容播放/暂停,并处理非致命LOG事件和致命的活跃播放错误。
  6. 清理:正确销毁AdsManager以释放资源,防止内存泄漏。
如需详细的特定平台实现细节,请始终参考前置条件部分中的指南。