JWAdsAdvertisingConfigBuilder

@objcMembers
public class JWAdsAdvertisingConfigBuilder : NSObject, JWBuilder

Used to build a JWAdvertisingConfig object to play ads using the JWPlayer client.

  • Declaration

    Swift

    public typealias Output = JWAdvertisingConfig
  • Builds an advertising config based off the settings provided.

    Throws

    throws An error if the config is not setup properly.

    Declaration

    Swift

    @objc
    public func build() throws -> JWAdvertisingConfig
  • Sets a VMAP URL.

    Declaration

    Swift

    @discardableResult
    public func vmapURL(_ vmapURL: URL) -> JWAdsAdvertisingConfigBuilder

    Parameters

    vmapURL

    Either a local or remote URL of the vmap file.

    Return Value

    The builder, so setters can be chained.

  • Sets an array of JWAdBreak objects that provide information about ad breaks.

    Note

    If an ad tag is also set using tag(), calling build() will throw an exception.

    Declaration

    Swift

    @discardableResult
    public func schedule(_ schedule: [JWAdBreak]) -> JWAdsAdvertisingConfigBuilder

    Parameters

    schedule

    An array of JWAdBreak objects that provide information about ad breaks.

    Return Value

    The builder, so setters can be chained.

  • Sets the URL of the VAST tag.

    Note

    Can also specify the VAST VMAP file to use for ad breaks.

    Note

    If an ad schedule is also set using schedule(), calling build() will throw an exception.

    Declaration

    Swift

    @discardableResult
    public func tag(_ tag: URL) -> JWAdsAdvertisingConfigBuilder

    Parameters

    tag

    The URL of the VAST tag to display.

    Return Value

    The builder, so setters can be chained.

  • Sets the rules for how often a user sees ads while watching the video content.

    Declaration

    Swift

    @discardableResult
    public func adRules(_ adRules: JWAdRules) -> JWAdsAdvertisingConfigBuilder

    Parameters

    adRules

    Defines playback rules for the scheduled ads.

    Return Value

    The builder, so setters can be chained.

  • Sets whether or not the player should open the default browser after the user clicks an ad. Default is true.

    Note

    Applicable to JW ad client only.

    Declaration

    Swift

    @discardableResult
    public func openBrowserOnAdClick(_ openBrowserOnAdClick: Bool) -> JWAdsAdvertisingConfigBuilder

    Parameters

    openBrowserOnAdClick

    Whether or not the player should open the default browser after the user clicks an ad.

    Return Value

    The builder, so setters can be chained.