JWPlayerConfigurationBuilder

@objcMembers
public class JWPlayerConfigurationBuilder : NSObject, JWBuilder

Used to build a JWPlayerConfiguration object to configure instance(s) of JWPlayer.

  • Declaration

    Swift

    public typealias Output = JWPlayerConfiguration
  • Builds player config based off the settings provided.

    Throws

    throws An error if the config is not setup properly.

    Declaration

    Swift

    public func build() throws -> JWPlayerConfiguration
  • Sets an array of JWPlayerItem objects containing information about different media items to be reproduced in a sequence.

    See also

    JWPlayerItem

    Declaration

    Swift

    @discardableResult
    public func playlist(_ playlist: [JWPlayerItem]) -> JWPlayerConfigurationBuilder

    Parameters

    playlist

    An array of JWPlayerItem objects containing information about different media items to be reproduced in a sequence.

    Return Value

    The builder, so setters can be chained.

  • Sets the playlist content url using a URL.

    Note

    If a playlist array is also set using playlist(), calling build() will throw an exception.

    Declaration

    Swift

    @discardableResult
    public func playlist(url: URL) -> JWPlayerConfigurationBuilder

    Parameters

    url

    The URL of the playlist content.

    Return Value

    The builder, so setters can be chained.

  • Sets the settings that control the behavior of ads.

    Declaration

    Swift

    @discardableResult
    public func advertising(_ advertising: JWAdvertisingConfig) -> JWPlayerConfigurationBuilder

    Parameters

    advertising

    Information about ad behavior.

    Return Value

    The builder, so setters can be chained.

  • Sets the settings for related content.

    See also

    JWRelatedConfig

    Declaration

    Swift

    @discardableResult
    public func related(_ related: JWRelatedContentConfiguration) -> JWPlayerConfigurationBuilder

    Parameters

    related

    Settings for related content.

    Return Value

    The builder, so setters can be chained.

  • Sets whether or not a video should start automatically after loading. Defaults to false.

    Declaration

    Swift

    @discardableResult
    public func autostart(_ autostart: Bool) -> JWPlayerConfigurationBuilder

    Parameters

    autostart

    Whether or not a video should start automatically after loading.

    Return Value

    The builder, so setters can be chained.

  • Sets whether or not content should be loaded prior to playback. Defaults to JWPreload.auto.

    Note

    JWPreload.auto loads the manifest before playback is requested.

    Note

    JWPreload.none doesn’t preload content. We recommend this if you are concerned about excess content usage.

    Declaration

    Swift

    @discardableResult
    public func preload(_ preload: JWPreload) -> JWPlayerConfigurationBuilder

    Parameters

    preload

    Whether or not the content should be loaded prior to playback.

    Return Value

    The builder, so setters can be chained.

  • Sets the maximum bitrate that can be reached during automatic quality switching. Useful for limiting bandwidth consumption by viewers.

    Note

    If network bandwith usage cannot be reduced to meet the bitrateUpperBound, it will be lowered as much as possible while continuing playback.

    Declaration

    Swift

    @discardableResult
    public func bitrateUpperBound(_ bitrateUpperBound: Float) -> JWPlayerConfigurationBuilder

    Parameters

    bitrateUpperBound

    The maximum bitrate that can be reached during automatic quality switching.

    Return Value

    The builder, so setters can be chained.

  • Sets whether or not content should repeat after it’s done playing. Defaults to false.

    Declaration

    Swift

    @discardableResult
    public func repeatContent(_ repeatContent: Bool) -> JWPlayerConfigurationBuilder

    Parameters

    repeatContent

    Whether or not content should repeat after it’s done playing.

    Return Value

    The builder, so setters can be chained.

  • Sets an array of metadata that can be passed externally to supplement the encoded metadata of the underlying media asset.

    Note

    Applies to all playlist items that do not specify their own external metadata.

    Note

    Capped at 5 metadata instances; the instances in excess will be excluded.

    Declaration

    Swift

    @discardableResult
    public func externalMetadata(_ externalMetadata: [JWExternalMetadata]) -> JWPlayerConfigurationBuilder

    Parameters

    externalMetadata

    An array of metadata to apply.

    Return Value

    The builder, so setters can be chained.

  • Defines what ad tracking library to use for analytics.

    Declaration

    Swift

    @discardableResult
    public func adTracker(_ tracker: JWAdTrackerConfig) -> JWPlayerConfigurationBuilder

    Parameters

    tracker

    A config for the desired ad tracker.