Rewarded Video Manual Integration Flutter
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 create a new listener: RewardedVideoManualListener.
This listener will trigger callbacks to inform you of ad availability and completions so you’ll know when to display ads and to reward your users.
The SDK will notify your listener of all possible events listed below:
class YourDartClass with IronSourceRewardedVideoListener {
/// Invoked when the ad is ready and can be displayed on the device
@override
void onRewardedVideoAdReady() {}
/// Invoked when no ad was loaded.
/// - [error] contains the reason for the failure.
@override
void onRewardedVideoAdLoadFailed(IronSourceError error) {}
/// Invoked when the RewardedVideo ad view has opened.
@override
void onRewardedVideoAdOpened() {}
/// Invoked when the RewardedVideo ad view is about to be closed.
@override
void onRewardedVideoAdClosed() {}
/// 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.
@override
void onRewardedVideoAvailabilityChanged(bool isAvailable) {
/// Change your RV traffic driver state here
}
/// 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.
@override
void onRewardedVideoAdRewarded(IronSourceRVPlacement placement) {}
/// Invoked when Rewarded Video failed to show.
/// [error] contains information about the failure.
@override
void onRewardedVideoAdShowFailed(IronSourceError error) {}
/// ------------------------------------------------------------------------
/// Note: the events 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].
@override
void onRewardedVideoAdClicked(IronSourceRVPlacement placement) {}
/// Invoked when the video ad starts playing.
@override
void onRewardedVideoAdStarted() {}
/// Invoked when the video ad finishes playing.
@override
void onRewardedVideoAdEnded() {}
}
Step 2: 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.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.