Get Started with Avocarrot

Overview

Examples

Android

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Troubleshooting

- Adapters

Admob Android Adapter

Mopub Android Adapter

iOS

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Troubleshooting

- Adapters

Admob iOS Adapter

Mopub iOS Adapter

API Documentation

Reporting API

Help

Supported Networks & Ad Types

General

Earnings

Payments and Accounting

Integration

Reporting

Mediation Network Optimization

Legal and Privacy

Updates

SDK Change Log

Android Change Log

iOS Change Log

Video

Updated 2 months ago ​by Chris

Overview

This tutorial helps you setup video ads in your Android app and receive your first ad.


Standard Video Ads are not yet supported in Avocarrot Exchange. You have to configure other 3rd party ad networks to get Video demand. Learn more about the supported ad networks and formats here.

Prerequisites

You need an Avocarrot account to complete the tutorial. Create an account
You need to create a Video ad unit for your app on your Avocarrot dashboard.
You need to setup the Avocarrot SDK. Setup SDK 

Setup Video Ads Mediation

ID of video ad space for testing (VIDEO): "87f65c4c-f12d-4bb6-96fd-063fe30c4d69"

The ID above is meant for testing purpose only, please replace it with the Ad unit Id of your placement from the dashboard.

Use the following methods in your UIViewController subclass:

objective-c

- (void)loadVideoWithAdUnitId:(NSString *_Nonnull)adUnitId
        success:(void (^ _Nullable)(AVOVideo *_Nonnull video))success
        failure:(void (^ _Nullable)(AVOError *_Nonnull error))failure; 

For example:

import <AvocarrotVideo/AvocarrotSDK+AVOVideo.h>
...
[AvocarrotSDK.sharedSDK loadVideoWithAdUnitId:@"87f65c4c-f12d-4bb6-96fd-063fe30c4d69"
                     success:^(AVOVideo *video) {
                        [video showFromViewController:self];
                     } failure:nil];
import AvocarrotVideo
...
AvocarrotSDK.shared.loadVideo(withAdUnitId: "87f65c4c-f12d-4bb6-96fd-063fe30c4d69", success: { [unowned self]
    video in
    video.show(from: self)
}, failure: nil)

Video events handling

To process video ad events, you should implement blocks or subscribe to notifications. The following is available:

MethodDescriptionNSNotificationCenter key
(void (^ _Nullable)(AVOVideo *_Nonnull video))successCalled after the video is served. After this method is called, the video ad is ready to be displayed.
(void (^ _Nullable)(AVOError *_Nonnull error))failureCalled if the video ad was not downloaded.
- (instancetype _Nonnull)onWillShow:(nullable void (^)(void))blockCalled when the video will show (will be shown).kAVONotification_VideoWillShow
- (instancetype _Nonnull)onDidShow:(nullable void (^)(void))blockCalled when the video did show (is shown).kAVONotification_VideoDidShow
- (instancetype _Nonnull)onWillHide:(nullable void (^)(void))blockCalled when the video will hide (will be closed).kAVONotification_VideoWillHide
- (instancetype _Nonnull)onDidHide:(nullable void (^)(void))blockCalled when the video is hidden (is closed).kAVONotification_VideoDidHide
- (instancetype _Nonnull)onStart:(nullable void (^)(void))blockCalled when the video is started.kAVONotification_VideoStarted
- (instancetype _Nonnull)onPause:(nullable void (^)(void))blockCalled when the video is paused.kAVONotification_VideoPause
- (instancetype _Nonnull)onResume:(nullable void (^)(void))blockCalled when the video is resumed.kAVONotification_VideoResume
- (instancetype _Nonnull)onComplete:(nullable void (^)(void))blockCalled when showing of a video has been completed.kAVONotification_VideoCompleted
- (instancetype _Nonnull)onWillLoad:(nullable void (^)(void))blockCalled before sending the video request to server.kAVONotification_VideoWillLoad
- (instancetype _Nonnull)onClick:(nullable void (^)(void))blockCalled after a click on the video. After this event the app will be minimized and an external browser will be opened.kAVONotification_VideoClicked

Advanced Customization

Go Live!

  1. Remove sandbox. If you have received a sample ad then simply disable the Sandbox mode by including the following instruction in your code:
    AvocarrotSDK.testMode = NO
    You should disable Sandbox mode ONLY when you are done with the integration and you are ready to publish your app. It is against Avocarrot's policies to use live ads during development, and doing so could get your Avocarrot account banned.
  2. Publish app. You are now ready to upload your app and start making money! If you have submitted your app in the Google Play/ Apple Store and you can see live ads, then you have nothing to worry about. Just wait until the impressions threshold has been reached and the app will be shown as live in your dashboard as well.
  3. Update payment details. Login to your account and update your payment settings.

Was this article useful?