Create a new Video Rewarded Ad Unit associated with a Prebid Server configuration ID and a video size.

RewardedVideoAdUnit(configId: String)


configId(String): Prebid Server configuration ID.

See AdUnit for additional parameters and methods.


Google Mobile Ads
Import the GoogleMobileAds from google-mobile-sdk.


//setup PB RewardedVideo
let adUnit = RewardedVideoAdUnit(configId: "1001-1")
//setup AM RewardedVideo
let amRewardedAd = GADRewardedAd(adUnitID: "adUnitId")
//load AM RewardedVideo
let amRequest = GADRequest()
let adUnit.fetchDemand(adObject: amRequest) { (resultCode: ResultCode) in
           amRewardedAd.load(amRequest) { error in
               if let error = error {
                   print("loadAMRewardedVideo failed:\(error)")
               } else {
                   if amRewardedAd?.isReady == true {
                       amRewardedAd?.present(fromRootViewController: self, delegate:self)

Import the Mopub SDK from Mopub.


//setup PB RewardedVideo
let adUnit = RewardedVideoAdUnit(configId: "1001-1")
//setup MP RewardedVideo
MPRewardedVideo.setDelegate(self, forAdUnitId: "adUnitId")
//load MP RewardedVideo
let targetingDict = NSMutableDictionary()
adUnit.fetchDemand(adObject: targetingDict) { (resultCode: ResultCode) in
           print("Prebid demand fetch for mopub \(")
           if let targetingDict = targetingDict as? Dictionary<String, String> {
               let keywords = Utils.shared.convertDictToMoPubKeywords(dict: targetingDict)
               MPRewardedVideo.loadAd(withAdUnitID: "adUnitId", keywords: keywords, userDataKeywords: nil, location: nil, mediationSettings: nil)