Ads_Objc

@objc(THEOplayerAds)
public protocol Ads_Objc

The Ads object helps you configure and control ads within THEOplayer.

  • Returns whether a linear ad is currently playing.

    Declaration

    Swift

    var playing: Bool { get }
  • Returns an array of the currently active ads.

    Remark

    • Can be linear and/or non linear.
    • If there are no ads playing, the method returns an empty array.

    Declaration

    Swift

    @objc(currentAds)
    var currentAds_Objc: [Ad_Objc] { get }
  • Returns the active AdBreak that contains the currently playing ad(s).

    Declaration

    Swift

    @objc(currentAdBreak)
    var currentAdBreak_Objc: AdBreak_Objc? { get }
  • Returns an array of AdBreaks that still need to be played.

    Declaration

    Swift

    @objc(scheduledAdBreaks)
    var scheduledAdBreaks_Objc: [AdBreak_Objc] { get }
  • Returns an array of ads that still need to be played.

    Declaration

    Swift

    @objc(scheduledAds)
    var scheduledAds_Objc: [ScheduledAd_Objc] { get }
  • Requests whether a linear ad is currently playing.

    Declaration

    Swift

    @available(*, deprecated, message: "This method will be removed with the next major release. Please use playing instead.")
    @objc(requestPlaying:)
    func requestPlaying_Objc(completionHandler: @escaping (Bool, Error?) -> Void)

    Parameters

    completionHandler

    A closure to invoke when the operation completes or fails.

  • Requests an array of the currently active ads.

    Remark

    Remark:

    • Can be linear and/or non linear.
    • If there are no ads playing, the method returns an empty array.

    Declaration

    Swift

    @available(*, deprecated, message: "This method will be removed with the next major release. Please use currentAds instead.")
    @objc(requestCurrentAds:)
    func requestCurrentAds_Objc(completionHandler: @escaping ([Ad_Objc]?, Error?) -> Void)

    Parameters

    completionHandler

    A closure to invoke when the operation completes or fails.

  • Requests the active AdBreak that contains the currently playing ad(s).

    Declaration

    Swift

    @available(*, deprecated, message: "This method will be removed with the next major release. Please use currentAdBreak instead.")
    @objc(requestCurrentAdBreak:)
    func requestCurrentAdBreak_Objc(completionHandler: @escaping (AdBreak_Objc?, Error?) -> Void)

    Parameters

    completionHandler

    A closure to invoke when the operation completes or fails.

  • Requests an array of adbreaks that still need to be played.

    Declaration

    Swift

    @available(*, deprecated, message: "This method will be removed with the next major release. Please use scheduledAdBreaks instead.")
    @objc(requestScheduledAdBreaks:)
    func requestScheduledAdBreaks_Objc(completionHandler: @escaping ([AdBreak_Objc]?, Error?) -> Void)

    Parameters

    completionHandler

    A closure to invoke when the operation completes or fails.

  • Requests an array of ads that still need to be played.

    Declaration

    Swift

    @available(*, deprecated, message: "This method will be removed with the next major release. Please use scheduledAds instead.")
    @objc(requestScheduledAds:)
    func requestScheduledAds_Objc(completionHandler: @escaping ([ScheduledAd_Objc]?, Error?) -> Void)

    Parameters

    completionHandler

    A closure to invoke when the operation completes or fails.

  • Schedules an ad.

    Remark

    Remark:

    • It will be added on top of the already existing ad(s).
    • If you want to replace the ads with new ones or set ads while setting up the player, you should set a SourceDescription with an AdDescription.

    Declaration

    Swift

    func schedule(adDescription: AdDescription_Objc)

    Parameters

    adDescription

    The ad to schedule.

  • Skips the current linear ad.

    Remark

    • This is only possible if the player has already played beyond the time where it can be skipped.
    • This will have no effect when the current linear ad is not (yet) skippable.

    Declaration

    Swift

    func skip()
  • Adds the given event listener of the given ad event type.

    Remark

    When attaching a listener on the wrong object the application will crash.

    Declaration

    Swift

    @discardableResult
    func addEventListener(type: String, listener: @escaping (EventProtocol) -> ()) -> EventListener

    Parameters

    type

    The type of the added event listener. See AdsEventTypes for possible values, limited to “ad…”, e.g. “adbegin”.

    listener

    Closure called when event is dispatched. Cast may be needed to the required class.

    Return Value

    EventListener that can be removed.

  • Removes the given event listener of the given ad event type.

    Declaration

    Swift

    func removeEventListener(type: String, listener: EventListener)

    Parameters

    type

    The type of the removed event listener. See AdsEventTypes for possible values.

    listener

    EventListener object that has been return on addEventListener.

  • The Open Measurement API.

    Remark

    Only available if the Google DAI Feature is enabled.

    Declaration

    Swift

    var omid: Omid { get }
  • The Google DAI API which can be used to query information about dynamically inserted advertisements.

    Declaration

    Swift

    var dai_Objc: GoogleDAI_Objc? { get }