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. The default value 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.

  • Sets the number of seconds to wait before enabling the skip button.

    The value set here will take priority over any value set in the VAST XML, or in JWAdInterfaceStyle. However, if there is a value set in a JWAdBreak, the value in the ad break will take priority.

    Note

    If nil is specified the skip ad button won’t be displayed at all.

    Declaration

    Swift

    @discardableResult
    public func skipOffset(_ offset: TimeInterval?) -> JWAdsAdvertisingConfigBuilder

    Parameters

    offset

    The number of seconds to wait before enabling the skip ad button.

    Return Value

    The builder, so setters can be chained.

  • Sets the JWPlayer client ad settings.

    Declaration

    Swift

    @discardableResult
    public func adSettings(_ settings: JWAdSettings) -> JWAdsAdvertisingConfigBuilder

    Parameters

    settings

    A JWAdSettings object.

    Return Value

    The builder, so setters can be chained.