Rewarded Video

Before You Start

Before integrating ads unit in your app, you must:

  • In the OpenMediation UI, create an app and create an ad placement. You can follow guides here.
  • Follow our steps to iOS SDK Integration by integrating the OpenMediation SDK into your project.
  • If you use mediation, go to Add Mediation Networks and make sure you have added the ad networks' SDKs and the corresponding adapters you wish to work with in your app.

Rewarded Video

Rewarded video ads with strong interactive ability has become the mainstream form of mobile advertising industry. It is becoming increasingly common for mobile game developers to rely more on built-in ads than IAP to monetize.

The OpenMediation Rewarded Video ad unit offers an engaging ad experience that rewards your users with valuable virtual content in exchange for a completed view. This user-initiated ad unit is great for gaming apps, and enhances users' app experience.

Step 1. Add the Delegate

The OpenMediation SDK fires several events to inform you of Ad activity. To show Ad to your user, you need to set up its Delegate before loading the ads to receive Ad status. The following snippets demonstrates how to configure Delegate for OMRewardedVideo object and implement the OMRewardedVideoDelegate to receive Ad events.

1. Add the following code to add your Delegate to OMRewardedVideo object and register to the received events. The SDK will notify the Delegate of all possible events listed in section 2 below.

Note: Here we use "self" which means the callback function is implemented in the current object.

[[OMRewardedVideo sharedInstance] addDelegate:self];
OMRewardedVideo.sharedInstance().add(self)

2. Implement the following callback function in your code to process ad logic when receiving the activity of your ad. For example invoke show function to serve Ad to your users when the rewarded video ad is ready.

/// Invoked when rewarded video is available.
 - (void)omRewardedVideoChangedAvailability:(BOOL)available{
    if(available){
         NSLog(@"VideoAd is Available");
    }
 }

 /// Sent immediately when a rewarded video is opened.
 - (void)omRewardedVideoDidOpen:(OMScene *)scene{
      NSLog(@"VideoAd is Open");
 }

 /// Sent immediately when a rewarded video starts to play.
 - (void)omRewardedVideoPlayStart:(OMScene *)scene{
      NSLog(@"VideoAd Start Play");
}

 /// Sent after a rewarded video has been clicked.
 - (void)omRewardedVideoDidClick:(OMScene *)scene{
      NSLog(@"VideoAd Did Click");
 }

 /// Send after a rewarded video has been completed.
 - (void)omRewardedVideoPlayEnd:(OMScene *)scene{
      NSLog(@"VideoAd Play End");
 }

 /// Sent after a rewarded video has been closed.
 - (void)OMRewardedVideoDidClose:(OMScene *)scene{
      NSLog(@"VideoAd Did Close");
 }

 /// Sent after a user has been granted a reward.
 - (void)omRewardedVideoDidReceiveReward:(OMScene *)scene{
      NSLog(@"Receive a reward");
 }

 /// Sent after a rewarded video has failed to play.
 - (void)omRewardedVideoDidFailToShow:(OMScene *)scene withError:(NSError *)error{
      NSLog(@"VideoAd failed to play");
 }
/// Invoked when rewarded video is available.
func omRewardedVideoChangedAvailability(_ available: Bool) {
    if available {
         print("VideoAd is Available")
    }
 }

 /// Sent immediately when a rewarded video is opened.
func omRewardedVideoDidOpen(_ scene: OMScene) {
      print("VideoAd is Open")
 }

 /// Sent immediately when a rewarded video starts to play.
func omRewardedVideoPlayStart(_ scene: OMScene) {
      print("VideoAd Start Play")
}

 /// Sent after a rewarded video has been clicked.
func omRewardedVideoDidClick(_ scene: OMScene) {
      print("VideoAd Did Click")
 }

 /// Send after a rewarded video has been completed.
func omRewardedVideoPlayEnd(_ scene: OMScene) {
      print("VideoAd Play End")
 }

 /// Sent after a rewarded video has been closed.
func omRewardedVideoDidClose(_ scene: OMScene) {
      print("VideoAd Did Close")
 }

 /// Sent after a user has been granted a reward.
func omRewardedVideoDidReceiveReward(_ scene: OMScene) {
      print("Receive a reward")
 }

 /// Sent after a rewarded video has failed to play.
func omRewardedVideoDidFail(toShow scene: OMScene, withError error: Error) {
      print("VideoAd failed to play")
 }

 

Step 2. Check Ad Availability (Optional)

Ad Availability

OpenMediation SDK automatic loads ads for you to cache the Rewared Video Ads during the application's lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the OMRewardedVideoDelegate, you will be notified about the ad availability through the OMRewardedVideoChangedAvailability callback. 

- (void)omRewardedVideoChangedAvailability:(BOOL)available{
      if(available){
         NSLog(@"VideoAd is Available");
      }
}
func omRewardedVideoChangedAvailability(_ available: Bool) {
    if available {
       print("VideoAd is Available")
    }
 }

 

Another way to check if the ad is avalible is by calling the isReady function directly. After you call the Add the Delegate in Step 1, you will be notified whether the video is ready to show through the isReady method.

/// Check OMRewardedVideo video is Ready.
[[OMRewardedVideo sharedInstance] isReady];
OMRewardedVideo.sharedInstance().isReady()

 

Step 3. Show a Rewarded Video Ad

We strongly recommend checking the ad's availibility by calling the isReady method before you serve Rewarded Video Ads, as shown in the following code:

if ([[OMRewardedVideo sharedInstance] isReady]) {
     [[OMRewardedVideo sharedInstance] showWithViewController:@"VIEW_CONTROLLER" scene:@"YOUR_SCENE_NAME"];
}
if OMRewardedVideo.sharedInstance().isReady() {
    OMRewardedVideo.sharedInstance().show(with: "VIEW_CONTROLLER", scene: "YOUR_SCENE_NAME")
}

Scene is a new concept being introduced for rewarded video and interstitial. It is used to represent different ad scenarios in your app.

You can use Scene-based frequency control, user rewards and data statistic etc. Go to OpenMediation UI to create multiple Scenes in Settings of Placement.

Notes: Scene is optional,if you don't want to use it just ignore the sceneName parameter or use value " ".

 

Step 4. Capping and Pacing (Optional)

You can use scene capping and pacing to improve your app's user experience by limiting the amount of ads served within a defined time frame.  You can configure capping and pacing settings for selected scenes in placement setting.

Important! To ensure you don't show the Rewarded Video button to prompt the user to watch an ad when the placement is capped, you must call the following method to verify if a specific placement has reached its ad limit.

/// Indicates whether the scene has reached the display frequency.
[[OMRewardedVideo sharedInstance] isCappedForScene:@"YOUR_SCENE_NAME"];
OMRewardedVideo.sharedInstance().isCapped(forScene:"YOUR_SCENE_NAME")

 

Step 5. Configure Rewarded Video Ad Callback

OpenMediation SDK supports the Rewarded Video Ad Server-side Callbacks. You can do this by defining a unique, private endpoint for us, and specify information that you want the OpenMediation server to pass. The way this works is the app on a user's device will contact OpenMediation servers for validation of a reward. Once a user has been validated by the OpenMediation server, we will send notification to the endpoint defined in your dashboard. Since a user's device will never be in contact with your server, this method prevents tampering with the reward events sent to your endpoint.

The server interaction of the rewarded video ad requires the developer to set the Ext Id to set the user authentication information, and the ExtID will be passed to the server as the transparent transmission parameter of the Rewarded Video display ad method.

if ([[OMRewardedVideo sharedInstance] isReady]) {
     [[OMRewardedVideo sharedInstance] showWithViewController:@"VIEW_CONTROLLER" scene:@"YOUR_SCENE_NAME" extraParams:@"EXT_VIDEO_ID"];
}
if OMRewardedVideo.sharedInstance().isReady() {
    OMRewardedVideo.sharedInstance().show(with: "VIEW_CONTROLLER", scene: "YOUR_SCENE_NAME", extraParams: "EXT_VIDEO_ID")
}

WechatIMG37.png

Endpoint Format

http://yourendpoint.com?variable_name_you_define={content}

{content} - This is the information that you want the OpenMediation server to pass.

Was this article helpful?
4 out of 6 found this helpful

Comments

0 comments

Article is closed for comments.