Documentation Index

Fetch the complete documentation index at: https://guide.ncloud-docs.com/llms.txt

Use this file to discover all available pages before exploring further.

Ad integration

Prev Next

Available in Classic and VPC

This guide explains how to integrate Google IMA (Interactive Media Ads) with the TV SDK.

Native build configuration (required)

To use Google IMA ads, you need to enable the native build flag.

tvOS(ios/Podfile)

For tvOS, add the following flag to your Podfile.

$RNVideoUseGoogleIMA = true

Configure the settings and run pod install.

Android TV(android/gradle.properties)

For Android TV, add the following flag to gradle.properties.

RNVideo_useExoplayerIMA=true
Caution

You must rebuild the app after changing the flags. Metro hot reload does not apply the change.

Ad settings

Set the VAST/VMAP ad tag using the options.ads property.

<VpePlayer
    accessKey="YOUR_ACCESS_KEY"
    options={{
        playlist: [{
            file: 'https://example.com/video.m3u8',
            poster: 'https://example.com/poster.jpg',
        }],
        autostart: true,
        ads: {
            tagUrl: 'https://pubads.g.doubleclick.net/gampad/ads?...',
            enabled: true,  // Default: Disable using true or false
        },
    }}
    onEvent={(event) => {
        switch (event.type) {
            case 'adStart':
                console.log('Ad started');
                break;
            case 'adComplete':
                console.log('Ad completed');
                break;
            case 'adSkip':
                console.log('Ad skipped');
                break;
            case 'adError':
                console.log('Ad error', event.data);
                break;
        }
    }}
    onBack={() => navigation.goBack()}
/>

Ad behavior

IMA ad behavior works as follows:

  • Automatically hides the control bar and ignores remote control input during ad playback.
  • Uses the native IMA SDK to render the ad UI.
  • Content automatically resumes after ad completion, skip, or error.

Ad events

You can receive the following ad events:

Event Description
adStart / adStarted Ad started
adComplete Ad completed
adSkip / adSkipped Ad skipped
adError Ad error
adLoaded Ad loaded
adBreakStart / adBreakEnd Ad break started/ended