Skip to main content

IMA

IMA SDKs simplify the process of incorporating multimedia advertisements into your web pages and applications. They can request ads from any VAST-compliant ad server and handle the playback of the ads within the app. By using the IMA client-side SDKs, you retain control of the content video playback while the SDK manages the ad playback. The ads are displayed in a separate video player that is overlaid on top of the app's content video player.

Plugin Name: ImaSdkPlugin

Plugin Config Name: ima

Clientside

Configuration

AttributeTypeDescription
adTagUrlstringAd Tag URL of the advertisement. (VAST, VPAID, VMAP, SIMID)
liveStreamPrefetchSecondsnumberInform IMA about when the ad should start loading before the ad shows.

VAST Example

import React, { useRef } from "react";
import { LuraPlayer, LuraPlayerProps } from "lura-react-native-core";

export default function MySampleComponent() {
const playerRef = useRef<LuraPlayer>(null);

const config = {
token:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2aWQiOiI0MzY2NjIzIiwiaXNzIjoiM1FMWjdaV0JsRko1Vk16Y2pyczJPbTd3VTdEanIzNFkifQ.CruM1W3gIEyQTBTqfaY5gTdf7b_2SSNg4gj6JGOj4Mg",
plugins: {
ima: {
adTagUrl:
"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=[correlator]",
},
},
};

return (
<View>
<LuraPlayer ref={playerRef} config={config} />
</View>
);
}

VMAP - Pre-roll Single Ad, Mid-roll Standard Pod with 3 ads, Post-roll Single Ad Example

import React, { useRef } from "react";
import { LuraPlayer, LuraPlayerProps } from "lura-react-native-core";

export default function MySampleComponent() {
const playerRef = useRef<LuraPlayer>(null);

const config = {
token:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2aWQiOiI0MzY2NjIzIiwiaXNzIjoiM1FMWjdaV0JsRko1Vk16Y2pyczJPbTd3VTdEanIzNFkifQ.CruM1W3gIEyQTBTqfaY5gTdf7b_2SSNg4gj6JGOj4Mg",
plugins: {
ima: {
adTagUrl:
"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpostpod&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator=[correlator]",
},
},
};

return (
<View>
<LuraPlayer ref={playerRef} config={config} />
</View>
);
}

DAI Serverside

VOD Configuration

AttributeTypeRequiredDescription
cmsIdstringYesContent Source ID
videostringYesVideo ID
apiKeystringNoAPI Key
import React, { useRef } from "react";
import { LuraPlayer, LuraPlayerProps } from "lura-react-native-core";

export default function MySampleComponent() {
const playerRef = useRef<LuraPlayer>(null);

const config = {
plugins: {
ima: {
cmsId: "2528370",
videoId: "tears-of-steel",
},
},
};

return (
<View>
<LuraPlayer ref={playerRef} config={config} />
</View>
);
}

Live Configuration

AttributeTypeRequiredDescription
assetKeystringNoAsset Key
apiKeystringYesAPI Key
import React, { useRef } from "react";
import { LuraPlayer, LuraPlayerProps } from "lura-react-native-core";

export default function MySampleComponent() {
const playerRef = useRef<LuraPlayer>(null);

const config = {
plugins: {
ima: {
assetKey: "c-rArva4ShKVIAkNfy6HUQ",
},
},
};

return (
<View>
<LuraPlayer ref={playerRef} config={config} />
</View>
);
}

Pod Serving

Pod Serving Configuration

AttributeTypeRequiredDescription
networkCodestringYesNetwork Code
customAssetKeystringYesCustom Asset Key
apiKeystringNoAPI Key
import React, { useRef } from "react";
import { LuraPlayer, LuraPlayerProps } from "lura-react-native-core";

export default function MySampleComponent() {
const playerRef = useRef<LuraPlayer>(null);

const config = {
plugins: {
ima: {
streamUrl:
"https://encodersim.sandbox.google.com/masterPlaylist/9c654d63-5373-4673-8c8d-6d92b66b9d46/master.m3u8?gen-seg-redirect=true&network=51636543&event=google-sample&pids=devrel4628000,devrel896000,devrel3528000,devrel1428000,devrel2628000,devrel1928000&seg-host=dai.google.com&stream_id=[[STREAMID]]",
networkCode: "51636543",
customAssetKey: "google-sample",
},
},
};

return (
<View>
<LuraPlayer ref={playerRef} config={config} />
</View>
);
}