Generated banner for Ima SDK Client Side
Generated logo for Ima SDK Client Side

Ima SDK Client Side

GoogleOfficialCreated by Google LLC

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • No issues found

From the author

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.
— the description by Google LLC

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The Google IMA SDK client-side skill provides the necessary framework to load and manage in-stream video and audio ads within websites, mobile apps, and TV platforms. It supports VAST and VMAP ad standards, enabling developers to request ads from compliant servers and coordinate playback between ad content and primary media. The skill emphasizes platform-specific implementation patterns for Android, iOS, and web environments, focusing on efficient resource management, proper ad container setup, and lifecycle handling to ensure a seamless user experience.

What it does

  • Facilitates client-side ad insertion for video and audio content.
  • Supports VAST and VMAP ad standards for ad server communication.
  • Provides platform-specific integration guides for Android, iOS, and web.
  • Manages ad playback events and content synchronization.
  • Includes lifecycle management for SDK initialization, ad requests, and resource cleanup.

When to use it

  • When you need to display in-stream video or audio ads on websites, mobile apps, or TV platforms.
  • When your ad server provides VAST or VMAP compliant ad tags.
  • When you require client-side control over ad playback and ad-to-content transitions.
  • When building applications on Android, iOS, or web platforms that require standard ad integration.

Advantages

  • Standardized approach to ad insertion across multiple digital platforms.
  • Supports industry-standard VAST and VMAP protocols.
  • Provides clear lifecycle management to prevent memory leaks and resource issues.
  • Enables granular control over ad playback and user experience coordination.

Usage examples

“How do I initialize the IMA SDK on Android to minimize latency?”
The SDK recommends calling ImaSdkFactory.initialize() in your Application.onCreate() to preload resources and reusing the same ImaSdkSettings instance across your AdsLoader.
“What is the correct way to clean up the IMA SDK on iOS?”
You must call destroy() on the AdsManager when ads complete or errors occur, and release the AdsLoader when the component is permanently destroyed to prevent memory leaks.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/google/ima-sdk-client-side/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip ima-sdk-client-side.zip -d .agents/skills

Documentation by Google LLC

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:


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.

Files

references/ima-sdk-tvos-guide.md

Google IMA SDK tvOS integration guide

The Google IMA SDK for tvOS is highly consistent with the iOS SDK, sharing the same API and integration flow.

Before proceeding, you must read the Google IMA SDK iOS Integration Guide for the complete step-by-step lifecycle flow (Initialization -> Ad Request -> Ad Load -> Playback -> Cleanup).

This document outlines the critical differences and tvOS-specific requirements you must implement.


Key differences from iOS

1. Import the SDK

By default, use Swift Package Manager to add the main branch of https://github.com/googleads/swift-package-manager-google-interactive-media-ads-tvos.

If the app must use CocoaPods, install the GoogleAds-IMA-tvOS-SDK pod.

2. Autoplay for tvOS

Add tvOS platform check to your app and make ad request with autoplay.

3. Focus management (tvOS specific)

To handle the Siri Remote, you must manage focus:

  • Ad UI Focus: The IMA SDK automatically manages the focus of the "Skip" button and other ad UI views when needed. Ensure your application's focus engine does not intercept or override focus changes, which would prevent the user from focusing and clicking the skip button.

  • Safe Area: Ensure your ad UI container respects the tvOS safe area layout guides to prevent ad overlays or skip buttons from being cut off by TV overscan.

4. Remote control gestures (tvOS specific)

To prevent user interactions from interfering with ad playback (e.g., fast-forwarding through an ad):

  • Disable Custom Gestures: You must disable your app's custom remote control gesture recognizers (such as play/pause, swiping, or menu button overrides) when the ad starts (on LOADED or STARTED events).

  • Restore Gestures: Re-enable your app's gestures only after the ad completes or a fatal error, using the adsManagerDidRequestContentResume delegate method.


Code implementation differences

Refer to the iOS Guide for the main AdsManager and PlayerViewController implementation. Adjust the tvOS implementation as follows:

Ad UI setup (safe area)

In your ViewController, align the ad container with the safe area layout guide to prevent TV overscan clipping:

func setupAdContainer(in viewController: UIViewController, overlaying videoView: UIView) -> UIView {
    let adContainerView = UIView()
    adContainerView.translatesAutoresizingMaskIntoConstraints = false
    viewController.view.addSubview(adContainerView)

    // tvOS Specific: Align with safe area to prevent overscan clipping
    let safeArea = viewController.view.safeAreaLayoutGuide
    NSLayoutConstraint.activate([
        adContainerView.leadingAnchor.constraint(equalTo: safeArea.leadingAnchor),
        adContainerView.trailingAnchor.constraint(equalTo: safeArea.trailingAnchor),
        adContainerView.topAnchor.constraint(equalTo: safeArea.topAnchor),
        adContainerView.bottomAnchor.constraint(equalTo: safeArea.bottomAnchor)
    ])

    return adContainerView
}
Focus management (preferred focus environments)

To ensure the Siri Remote can focus on the SDK's interactive elements (like the "Skip" button), you must call the setNeedsFocusUpdate() function and override the preferredFocusEnvironments property of the ViewController object at the IMAAdEvent.Type.STARTED event.

You must revert to standard focus rules when the ad finishes playing, such as IMAAdEvent.Type.COMPLETE or IMAAdEvent.Type.SKIPPED event.

import UIKit
import GoogleInteractiveMediaAds

class YourViewController: UIViewController, IMAAdsManagerDelegate {

    // Tracks state to determine who gets focus
    var isAdPlaying: Bool = false
    var adDisplayContainer: IMAAdDisplayContainer?

    // MARK: - Focus Management

    override var preferredFocusEnvironments: [UIFocusEnvironment] {
        // Check if an ad is playing and if the IMA SDK has a valid focus environment
        if isAdPlaying, let adFocusEnvironment = adDisplayContainer?.focusEnvironment {
            // Hand focus routing over to the IMA SDK UI (e.g., "Skip" button)
            return [adFocusEnvironment]
        }

        // Otherwise, use the app's standard focus rules (e.g., video player controls)
        return super.preferredFocusEnvironments
    }

    // MARK: - IMAAdsManagerDelegate Methods

    func adsManager(_ adsManager: IMAAdsManager, didReceive event: IMAAdEvent) {
        switch event.type {
        case .LOADED:
            // tvOS Specific: Disable custom remote gestures during ad
            disableAppGestures()
            adsManager.start()

        case .STARTED:
            // Update state and force tvOS to move focus to the ad
            isAdPlaying = true
            setNeedsFocusUpdate()

        case .COMPLETE, .SKIPPED, .ALL_ADS_COMPLETED:
            // Update state and reclaim focus back to the app
            isAdPlaying = false
            setNeedsFocusUpdate()

        default:
            break
        }
    }

    func adsManagerDidRequestContentResume(_ adsManager: IMAAdsManager) {
        // tvOS Specific: Restore gestures when ad break finishes
        enableAppGestures()
        resumeContent()
    }

    func adsManager(_ adsManager: IMAAdsManager, failedWith error: IMAAdError) {
        // Safety check: Reset focus state just in case an ad fails mid-playback
        isAdPlaying = false
        setNeedsFocusUpdate()

        // tvOS Specific: Restore gestures on failure
        enableAppGestures()
        cleanupAds()
        resumeContent()
    }

    // MARK: - App-Specific Helpers (Implementation depends on your app)

    private func disableAppGestures() { /* ... */ }
    private func enableAppGestures() { /* ... */ }
    private func resumeContent() { /* ... */ }
    private func cleanupAds() { /* ... */ }
}

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Google LLC
Publisher
Google (Official)
Source
google/skills · skills/ads/ima-sdk-client-side · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google LLC or Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download ima-sdk-client-side.zip