Rewarded Video Manual Integration React Native

In addition to loading ironSource rewarded video ads automatically, you can also set rewarded video ads to load manually. To do this, you must set the entire session loading mode prior to SDK initialization. This is supported from ironSource SDK 7.2.0+ (Beta 7.1.13 Android).

Step 1: Set up rewarded video manual loading

Set the operation mode of rewarded video ads before you initialize the ironSource SDK. By setting the manual mode, you will also set rewarded video manual load listeners.

This listener will trigger callbacks to inform you of ad availability and completions so you’ll know when to display ads and reward your users.

Import the following event class from the IronSource mediation:

import {
  IronSource,
  LevelPlayRewardedVideoEvents,
  IronSourceRVPlacement,
  IronSourceAdInfo,
  IronSourceError,
} from 'ironsource-mediation'

The SDK will notify your listener of all possible events listed below:

/**
 * Invoked when the ad is ready and can be displayed on the device.
 */
LevelPlayRewardedVideoEvents.onAdReady.setListener((adInfo: IronSourceAdInfo) => {});
/**
 * Invoked when no ad was loaded.
 * Error contains the reason for the failure.
 */
LevelPlayRewardedVideoEvents.onAdLoadFailed.setListener((ironSourceError: IronSourceError, adInfo: IronSourceAdInfo) => {});
/**
 * Invoked when the RewardedVideo ad view has opened.
 */
LevelPlayRewardedVideoEvents.onAdOpened.setListener((adInfo: IronSourceAdInfo) => {});
/**
 * Invoked when the RewardedVideo ad view is about to be closed.
 */
LevelPlayRewardedVideoEvents.onAdClosed.setListener((adInfo: IronSourceAdInfo) => {});
/**
 * Invoked when there is a change in the ad availability status.
 * isAvailable reflects the availability of Rewarded Video. 
 * You can show the video by calling showRewardedVideo when isAvailable is true.
 * isAvailable would be false when no videos are available.
 */
LevelPlayRewardedVideoEvents.onAdAvailable.setListener((adInfo: IronSourceAdInfo) => {});
LevelPlayRewardedVideoEvents.onAdUnavailable.setListener(() => {});
/**
 * Invoked when the user completed the video and should be rewarded.
 * placement contains the reward data.
 * If you are using server-to-server reward callbacks,
 * you may ignore this event and wait for a callback from the ironSource server.
 */
LevelPlayRewardedVideoEvents.onAdRewarded.setListener((placement: IronSourceRVPlacement, adInfo: IronSourceAdInfo) => {});
/**
 * Invoked when Rewarded Video failed to show.
 * You can learn about the reason by examining error
 */
LevelPlayRewardedVideoEvents.onAdShowFailed.setListener((ironSourceError: IronSourceError, adInfo: IronSourceAdInfo) => {});
/** ------------------------------------------------------------------------
 * Note: the event below are not available for all the supported Rewarded Video ad networks.
 * Check which events are available per ad network you included in your build.
 * We recommend using only events that are supported by ALL the ad networks you selected.
 * -------------------------------------------------------------------------*/
/**
 * Invoked when the video ad is clicked.
 * The reward data of the clicked ad is passed as placement.
 */
LevelPlayRewardedVideoEvents.onAdClicked.setListener((placement: IronSourceRVPlacement, adInfo: IronSourceAdInfo) =>{});

Set the manual load mode

// Set the listener before init to enable the Manual Load mode
await IronSource.setManualLoadRewardedVideo();

Step 2: Manually load rewarded video ads

Request a rewarded video ad before you plan on showing it to your users as the loading process can take time. Use the following API to load your ad: 

IronSource.loadRewardedVideo();

If you’d like to serve multiple rewarded video ads in your app, you should repeat this step after you’ve shown and closed the previous rewarded video ad. Once the onRewardedAdClosed callback is triggered, you’ll be able to load a new rewarded video ad.

Done!

After defining your operation loading mode to Manual, you can complete your Rewarded Video integration, as described here.