VideoInterstitialAdUnit

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

Currently Google Ad Manager is the only supported ad server. We plan to provide support for additional ad servers in subsequent releases.

See AdUnit for additional parameters and methods.

VideoInterstitialAdUnit(configId: String, size: CGSize(width: Int, height: Int), type:Enum)

Parameters

configId(String): Prebid Server configuration ID

size(CGSize): Width and height of the video ad unit

type:Enum: OpenRTB Placement Type

CGSize

Size of video ad unit.

Parameters

width: Width of video ad unit in DIPs.

height: Height of video ad unit in DIPs.

type

OpenRTB Placement Type represented as an enumeration of values:

  • inBanner is transformed into OpenRTB value 2 to bid adapters
  • inArticle is transformed into OpenRTB value 3 to bid adapters
  • inFeed is transformed into OpenRTB value 4 to bid adapters

videoAd: Video Events

videoAd

  • Video event listeners

videoAd (event: PBVideoAdEvent): Event to listen to.

Parameters

Events - one of these event types:

  • AdLoadSuccess
  • AdLoadFail
  • AdClicked
  • AdStarted
  • AdDidReachEnd

See AdUnit for additional parameters and methods.


Example

Google Mobile Ads
Import the GoogleMobileAds from google-mobile-sdk into the UIViewController displaying the VideoAdUnit.

Swift

    var adUnit: AdUnit!
    var amInterstitial: DFPInterstitial!

    func setupAndLoadAMInterstitialVAST() {

        setupPBInterstitialVAST()
        setupAMInterstitialVAST()

        loadInterstitial()
    }

    func setupPBInterstitialVAST() {
        Prebid.shared.prebidServerHost = .Rubicon
        Prebid.shared.prebidServerAccountId = "accountId"
        adUnit = VideoInterstitialAdUnit(configId: "configId", size: CGSize(width: 300, height: 250), type: .inBanner)
    }

    func setupAMInterstitialVAST() {
        amInterstitial = DFPInterstitial(adUnitID: "/5300653/test_adunit_vast_pavliuchyk")
    }

    func loadInterstitial() {

        adUnit.fetchDemand(adObject: self.request) { (resultCode: ResultCode) in
            print("Prebid demand fetch for DFP \(resultCode.name())")
        }
    }