InstreamAdBinder

@objc(YMAInstreamAdBinder)
@objcMembers
public class InstreamAdBinder : NSObject

InstreamAdBinder automatically presents instream ads.

  1. delegate
  2. init(ad:adPlayer:videoPlayer:)
  3. bind(with:)
  4. unbind()
  5. invalidateVideoPlayer()
  6. invalidateAdPlayer()
  7. prepareAd()

delegate

This object will be notified about the instream ad lifecycle.

Declaration

Swift

public weak var delegate: InstreamAdBinderDelegate?

init(ad:adPlayer:videoPlayer:)

Initializes a new object of the InstreamAdBinder class.

ad: An ad loaded with InstreamAdLoader.
  • adPlayer: Player that manages ad playback.
  • videoPlayer: Player that manages content video playback.
  • Declaration

    Swift

    public convenience init(
        ad: InstreamAd,
        adPlayer: InstreamAdPlayer,
        videoPlayer: VideoPlayer
    )

    bind(with:)

    Binds InstreamAdBinder to the ad view and starts ad playback.

    adView: InstreamAdView that contains ad and content player views.

    Declaration

    Swift

    public func bind(with adView: InstreamAdView)

    unbind()

    Unbinds binder from the ad view and frees resources.

    Declaration

    Swift

    public func unbind()

    invalidateVideoPlayer()

    This method should be called if corresponding VideoPlayer can not be used anymore.

    Declaration

    Swift

    public func invalidateVideoPlayer()

    invalidateAdPlayer()

    This method should be called if corresponding InstreamAdPlayer can not be used anymore.

    Declaration

    Swift

    public func invalidateAdPlayer()

    prepareAd()

    Preloads the ad. Use this method before calling bind.

    Declaration

    Swift

    public func prepareAd()