Skip to content

Video Ad Integration

rprunskas edited this page Feb 18, 2016 · 5 revisions

Preparing view in code

For the AdInline to load video ads, you need to integrate the ad view as described in Integrating Inline Ad. The only thing that you need to change is setting property setBannerType(AdInline.BannerType.VIDEO).

adView = (AdInline) findViewById(R.id.custom_ad_view);
adView.setMasterTagId(12345);
adView.setBannerType(AdInline.BannerType.VIDEO);

Now the view is ready to load video banners. Just execute loadAd(); and banner will be loaded.

adView.loadAd();

Whole video ad set up can be found in SampleDemo app with its custom configuration settings.

Custom properties

Video ad has custom properties that defines some of the video view behavior.

Debug mode

To test how the video banner handles VAST type of content, you can enable debug mode, and provide the configuration directly to be rendered by the view. All you need to do is to set debug mode setDebugMode([true/false]), and pass in debug content setDebugContent([VAST configuration content as String]).

adView.setDebugMode(true);
adView.setDebugContent(Utils.isToString(getResources().openRawResource(R.raw.vast)));

For more information, try looking at SampleDemo.

Mute on initialization

By default, when video is loaded and started, video is muted. To edit this behavior you can use setVideoMuteOnInit([true/false]).

adInline.setVideoMuteOnInit(true);

Close when finished

By default, video banner will close after its finished playing content. To edit this behavior you can use setVideoCloseOnComplete(true/false).

adInline.setVideoCloseOnComplete(true);

Close button show behavior

By default, close button is always hidden when video ad is displayed. This property can be changed by defining property type in setVideoCloseButtonShowBehavior(VideoSettings.CloseButtonShowBehavior.[ALWAYS/AFTER_COMPLETE/HIDE]).

adInline.setVideoCloseButtonShowBehavior(VideoSettings.CloseButtonShowBehavior.ALWAYS);
adInline.setVideoCloseButtonShowBehavior(VideoSettings.CloseButtonShowBehavior.AFTER_COMPLETE);
adInline.setVideoCloseButtonShowBehavior(VideoSettings.CloseButtonShowBehavior.HIDE);

Skin

Video player also has different skin types that can be set by using setVideoPlayerSkinType(AdformEnum.VideoPlayerSkinType.[DEFAULT/MINIMAL]).

adInline.setVideoPlayerSkinType(AdformEnum.VideoPlayerSkinType.DEFAULT);
adInline.setVideoPlayerSkinType(AdformEnum.VideoPlayerSkinType.MINIMAL);
	

Video ads fallback

In order to set up video ads fallback, you need to set fallback master tag of other HTML ad.

adInline.setFallbackMasterTagId(123456);
Clone this wiki locally