AdManagerDelegate

@objc(AASDKAdManagerDelegate)
public protocol AdManagerDelegate

@protocol

The AdManagerDelegate protocol defines the methods used to retrieve information about ad playback (impression, quartiles, etc).

  • Called when there was an error playing the ad. Log the error and resume playing content. Note: evaluate the error by casting it to either SDKError or a specific AVPlayer error. (e.g by checking the NSError code such as NSURLErrorTimedOut, NSURLErrorFileDoesNotExist)

    Declaration

    Swift

    @objc
    func adManager(_ adManager: AdManager, didReceiveAd ad: AdData?, error: Error)

    Parameters

    adManager

    The AdManager where the error originated

    ad

    The ad which caused the error

    error

    The error received

  • Called when there is an event in connection with the current ad in the ad manager.

    Declaration

    Swift

    @objc
    func adManager(_ adManager: AdManager, didReceiveAdEvent event: AdEvent)

    Parameters

    adManager

    The AdManager that sent the event

    event

    The event received

  • Called when the playhead for the internal player has changed on the current ad. It will also be called when the playhead positions itself on 0 or close to 0, immediately after the `.didStartPlaying’ event. The frequency of calling this function depends on how frequently the internal player is sending updates to the SDK. This usually happens at 1s intervals but you can expect more frequent updates if the player considers it necessary to do so.

    Declaration

    Swift

    @objc
    optional func adManager(_ adManager: AdManager, ad: AdData, didChangedPlayHead playHead: TimeInterval, adDuration duration: TimeInterval)

    Parameters

    adManager

    The AdManager that sent the event

    ad

    The ad that is being played

    playHead

    The current position of the play head. Should be in the interval [0..duration].

    duration

    The total duration of the ad media as reported by the internal SDK player.