Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageswift
import UIKit
import R89SDK

class ViewController: UIViewController {
    ...
    @IBOutlet weak var adContainer: UIView!
    ...
    override func viewDidLoad() {
        super.viewDidLoad()
        ...
        let outstreamConfigId = ConfigBuilder.companion.VIDEO_OUTSTREAM_TEST_R89_CONFIG_ID
        RefineryAdFactoryR89AdFactory.shared.createVideoOutstreamBanner(
          configurationID: outstreamConfigId, 
          wrapper: wrapper, 
          lifecycleCallbacks: nil)
    }
    ...
}

...

You can subscribe to these events with the same RefineryAdFactoryR89AdFactory.shared.createVideoOutstreamBanner(...) method by passing an instance of BannerEventListener for the lifecycleCallbacksparameter. Details about this object can be found in the Reference.

First, extend from the BannerEventListener. Next, provide the instance of BannerEventLogger to RefineryAdFactoryR89AdFactory.shared.createVideoOutstreamBanner(...,:lifecycleCallbacks).

Code Block
languageswift
import UIKit
import R89SDK

// 1. Extend from the Banner EventListener
private class OutstreamLivecycleListener : BannerEventListener {
    ...
    override func onLoaded() {
        // Ad has been loaded
    }
    ...
}

class ViewController: UIViewController {
    ...
    @IBOutlet weak var adContainer: UIView!
    ...
    override func viewDidLoad() {
        super.viewDidLoad()
        ...
        let outstreamConfigId = ConfigBuilder.companion.VIDEO_OUTSTREAM_TEST_R89_CONFIG_ID
        let outstreamLifecycleListener = OutstreamLivecycleListener()
        // 2. Pass the outstreamLifecycleListener instance via lifecycleCallbacks
        RefineryAdFactoryR89AdFactory.shared.createVideoOutstreamBanner(
          configurationID: outstreamConfigId, 
          wrapper: adContainer, 
          lifecycleCallbacks: outstreamLifecycleListener)
    }
    ...
}

...