Rewarded Video Manual Integration Unity
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 for Android).
Step 1. Implement the Rewarded Video Manual Events
The ironSource Unity Plugin fires events to inform you of ad availability. These events will be triggered only upon manual rewarded video implementation.
Add the following code to register to the events, in addition to the Rewarded Video events described here.
//Add AdInfo Rewarded Video Events
IronSourceRewardedVideoEvents.onAdReadyEvent += RewardedVideoOnAdReadyEvent;
IronSourceRewardedVideoEvents.onAdLoadFailedEvent += RewardedVideoOnAdLoadFailedEvent;
IronSourceRewardedVideoEvents.onAdOpenedEvent += RewardedVideoOnAdOpenedEvent;
IronSourceRewardedVideoEvents.onAdClosedEvent += RewardedVideoOnAdClosedEvent;
IronSourceRewardedVideoEvents.onAdShowFailedEvent += RewardedVideoOnAdShowFailedEvent;
IronSourceRewardedVideoEvents.onAdRewardedEvent += RewardedVideoOnAdRewardedEvent;
IronSourceRewardedVideoEvents.onAdClickedEvent += RewardedVideoOnAdClickedEvent;
The Plugin will notify the Listener of all possible events listed below:
/************* RewardedVideo AdInfo Delegates *************/
// Indicates that the Rewarded video ad was loaded successfully.
// AdInfo parameter includes information about the loaded ad
void RewardedVideoOnAdReadyEvent(IronSourceAdInfo adInfo) {
}
// Indicates that the Rewarded video ad failed to be loaded
void RewardedVideoOnAdLoadFailedEvent(IronSourceError error) {
}
// The Rewarded Video ad view has opened. Your activity will loose focus.
void RewardedVideoOnAdOpenedEvent(IronSourceAdInfo adInfo){
}
// The Rewarded Video ad view is about to be closed. Your activity will regain its focus.
void RewardedVideoOnAdClosedEvent(IronSourceAdInfo adInfo){
}
// The user completed to watch the video, and should be rewarded.
// The placement parameter will include the reward data.
// When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback.
void RewardedVideoOnAdRewardedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo){
}
// The rewarded video ad was failed to show.
void RewardedVideoOnAdShowFailedEvent(IronSourceError error, IronSourceAdInfo adInfo){
}
// Invoked when the video ad was clicked.
// This callback is not supported by all networks, and we recommend using it only if
// it's supported by all networks you included in your build.
void RewardedVideoOnAdClickedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo){
}
Step 2: Set up rewarded video manual loading
Set the operation mode for rewarded video ads before you initialize the ironSource SDK. This will affect your current session.
IronSource.Agent.setManualLoadRewardedVideo(bool isRewardedVideoManualAPI);
Step 3: Manually load rewarded video ads
Request a rewarded video ad d 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.Agent.loadManualRewardedVideo();
Done!
After defining your operation loading mode to Manual, you can complete your Rewarded Video integration, as described here.