Wiki

Clone wiki

Fullscreen and RV Sample / RewardedVideo Documentation (AATKit 2)

Rewarded Video Integration

Index:

Rewarded Video

Important: Only one rewarded video can load at the same time. In other words, it is not possible to load and buffer more than one rewarded video.

Please also note: Due to limitations of some ad network SDKs, it’s not possible to use multiple placements for rewarded videos. Hence, AddApptr is limiting the usage of rewards video placements to a single placement.

Create RewardedVideo Placement

Creating a rewarded video placement

Objective-C:

[AATKit createRewardedVideoPlacement:@"RewardedVideo"];
Swift:
AATKit.createRewardedVideoPlacement("RewardedVideo")

Requesting Rewarded Video Ad

after that to request an Ad you can automatically load and reload rewarded video placements or manually load rewarded video placements

To automatically load rewarded video Placement you can use:

Objective-C:

// Start rewarded video placement auto-reloading to automatically
// download new rewarded video ad after presenting the current one.
[AATKit startPlacementAutoReload:self.rewardedVideoPlacement];
Swift:
// Start rewarded video placement auto-reloading to automatically
// download new rewarded video ad after presenting the current one.
AATKit.startPlacementAutoReload(rewardedVideoPlacement)

In this scenario, a rewarded video Ad is loaded automatically. It is reloaded only if a previous rewarded video Ad has already been displayed.

To manually loading a rewarded video ad, the following method can be used:

Objective-C:

[AATKit reloadPlacement:rewardedVideoPlacement];
Swift:
AATKit.reload(rewardedVideoPlacement)

Displaying a Rewarded Video Ad

Displaying a rewarded video ad can be done in two ways.

First, the AATKit can be told to display a rewarded video placement using the following method:

Objective-C:

[AATKit showPlacement:rewardedVideoPlacement];
Swift:
AATKit.show(rewardedVideoPlacement)

The method will return a bool value indicating whether the rewarded video placement could be displayed or not. This means whether it could be filled with an Ad by an Ad network. Thus, it is possible to use the following construct to react based on whether the rewarded video placement was displayed or not:

Objective-C:

#!objective-c
if ( ! [AATKit showPlacement:rewardedVideoPlacement] ) { 
 NSLog(@"rewarded video Ad could not be displayed");
}
Swift:
#!swift
if !AATKit.show(rewardedVideoPlacement) {
 print("rewarded video Ad could not be displayed")
}

Calling the method showPlacement does increase the AdSpace count, which is used to calculate the fill rate. An AdSpace expresses the intention to show an ad.

Another approach to receive feedback indicating whether the rewarded video Ad is ready for display, is to use the AATKit delegate callbacks AATKitHaveAd:.

Warning : This callback should be used for banner and rewarded video placements only. It's not recommended to use this callback for rewarded video placements. Trying to display a rewarded video placement by reacting on the callback, prevents counting an AdSpace (by not calling showPlacement) if no ad is available. Example call:

Objective-C:

- (void) AATKitHaveAd:(id)placement {
 if ([placement isEqual:[AATKit getPlacementWithName:@"RewardedVideo"]]){ 
 [AATKit showPlacement:placement];
 }
}
Swift:
func aatKitHaveAd(_ placement: AATKitPlacement) {
 if placement.isEqual(AATKit.getPlacementWithName("RewardedVideo")) {
 AATKit.show(placement)
 }
}

Assign a specific view controller to a placement

Setting a view controller during initialization of the AATKit, or by using the method + (void) setViewController:(nullable UIViewController*)con; sets a global view controller used by all placements.

It's also possible to assign a placement specific view controller, by using the following method:

Objective-C:

[AATKit setPlacementViewController:self forPlacement:rewardedVideoPlacement];
Swift:
[AATKit setPlacementViewController:self forPlacement:rewardedVideoPlacement];

Setting a placement-specific view controller will override any global view controller.

Rewarded Video Callbacks

The callback for an 'incentive earned' may be invoked even if the placement is not a placement that is configured to use rewarded video. This is because some ad networks do not allow for differentiating between rewarded and non rewarded video. Since the callback

#!objective-c
- (void) AATKitUserEarnedIncentiveOnPlacement: (nonnull NSObject<AATKitPlacement>*) placement withReward: (nullable AATKitReward *) reward;

provides a reference to the placement that triggered the callback, it's possible to identify whether the incentive was earned via the desired placement.

also, this callback passes an AATKitReward object that represents the reward object which is

@interface AATKitReward: NSObject
@property (readonly) NSString* name;
@property (readonly) NSString* value;
@end

Pubnative close button waiting time

You can set the close button waiting time for Pubnative rewarded video by adding the key AATKitPubnativeOffsetSecsVideoLInterstitial to your Info.plist and set it to the desired value in seconds

Listening to statistics events

AATKitStatisticsDelegate is an optional delegate you can implement if you need to get notified about statistics events. and pass it to placement while creating it using this method

+ (nullable NSObject<AATKitPlacement>*)createRewardedVideoPlacement:(nonnull NSString*)placementName
 andStatisticsDelegate:(nullable NSObject <AATKitStatisticsDelegate>*)statisticsDelegate;

for more info about it please refer to AATKitStatisticsDelegate Guide

SampleApp

Updated