Ads
public protocol Ads : EventDispatcherProtocol
The Ads object helps you configure and control ads within THEOplayer.
-
Requests whether or not a linear ad is currently playing.
Declaration
Swift
func requestPlaying(completionHandler: @escaping (Bool?, Error?) -> Void)
Parameters
completionHandler
A closure to invoke when operation completes or fails
-
Requests an array of the currently active ads (linear and/or non linear). If there are no ads playing, the method returns an empty array.
Declaration
Swift
func requestCurrentAds(completionHandler: @escaping ([Ad]?, Error?) -> Void)
Parameters
completionHandler
A closure to invoke when operation completes or fails
-
Requests the active AdBreak (containing the currently playing Ad).
Declaration
Swift
func requestCurrentAdBreak(completionHandler: @escaping (AdBreak?, Error?) -> Void)
Parameters
completionHandler
A closure to invoke when operation completes or fails
-
Requests an array of ads that still needs to be played.
Declaration
Swift
func requestScheduledAds(completionHandler: @escaping ([ScheduledAd]?, Error?) -> Void)
Parameters
completionHandler
A closure to invoke when operation completes or fails
-
Schedules an ad. It will be added on top of the already existing ads. (**) Alternatively, 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)
Parameters
adDescription
The ad to schedule.
-
Skips the current linear ad. This is only possible if the player has already played beyond the time where it can be skipped.
Declaration
Swift
func skip()
-
Adds the given event listener of the given AdsEventType
Remark
When attaching a listener on the wrong object the application will crash.
Declaration
Swift
func addEventListener<E>(type: EventType<E>, listener: @escaping (E) -> ()) -> EventListener where E : EventProtocol
Parameters
type
AdsEventType of the added event listener
listener
Closure called when event is dispatched
Return Value
EventListener that can be removed
-
Removes the given event listener of the given AdsEventType
Declaration
Swift
func removeEventListener<E>(type: EventType<E>, listener: EventListener) where E : EventProtocol
Parameters
type
AdsEventType of the removed event listener
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 }