Rewarded Video Manual Integration for Xamarin iOS

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+. 

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.

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.To receive these events, we suggest the following:

  1. Create a class which inherits from LevelPlayManualRewardedVideoDelegate. It is recommend to create a separate class for each delegate
       public class RewardedVideoLevelPlayManualDelegate : LevelPlayRewardedVideoManualDelegate
        {
            private ViewController viewController;
            public RewardedVideoLevelPlayManualDelegate(ViewController viewController)
            {
                this.viewController = viewController;
            }
           //Invoked when the end user clicked on the RewardedVideo ad
            public override void didClick(ISPlacementInfo placementInfo, ISAdInfo adInfo)
            {
            }
           //Invoked when the RewardedVideo ad view is about to be closed.
            public override void didCloseWithAdInfo(ISAdInfo adInfo)
            {
            }
            // Indicates that the ad failed to load
            public override void didFailToLoadWithError(NSError error)
            {
            }
           //Invoked when RewardedVideo call to show a rewarded video has failed
            public override void didFailToShowWithError(NSError error, ISAdInfo adInfo)
            {
            }
           // Indicates that the ad was loaded
            public override void didLoadWithAdInfo(ISAdInfo adInfo)
            {
            }
           //Invoked when the RewardedVideo ad view has opened.
            public override void didOpenWithAdInfo(ISAdInfo adInfo)
            {
            }
           //Invoked when the user completed the video and should be rewarded.
            public override void didReceiveRewardForPlacement(ISPlacementInfo placementInfo, ISAdInfo adInfo)
            {
            }
        }
    

  2. Create and instantiate a RewardedVideoLevelPlayManualDelegate object. Set the delegate using the new object.
    Make sure to call the setLevelPlayRewardedVideoDelegate before the SDK initialisation. 
RewardedVideoLevelPlayManualDelegate mRewardedVideoLevelPlayManualDelegate;
// Define the listener 
mRewardedVideoLevelPlayManualDelegate = new RewardedVideoLevelPlayManualDelegate(this);
// Set the delegate
IronSource.setLevelPlayRewardedVideoManualDelegate(mRewardedVideoLevelPlayManualDelegate);

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 rewardedVideoDidClose delegate 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.