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
JWPlayerItemobjects containing information about different media items to be reproduced in a sequence.See also
JWPlayerItemDeclaration
Swift
@discardableResult public func playlist(items: [JWPlayerItem]) -> JWPlayerConfigurationBuilderParameters
itemsAn array of
JWPlayerItemobjects containing information about different media items to be reproduced in a sequence.Return Value
The builder, so setters can be chained.
-
Sets an array of
JWPlayerItemobjects containing information about different media items to be reproduced in a sequence.See also
JWPlayerItemDeclaration
Swift
@available(*, deprecated, renamed: "playlist(items:﹚") @discardableResult public func playlist(_ playlist: [JWPlayerItem]) -> JWPlayerConfigurationBuilderParameters
playlistAn array of
JWPlayerItemobjects 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.
Declaration
Swift
@discardableResult public func playlist(url: URL) -> JWPlayerConfigurationBuilderParameters
urlThe URL of the playlist content.
Return Value
The builder, so setters can be chained.
-
Sets the settings that control the behavior of ads.
See also
JWAdvertisingConfigDeclaration
Swift
@discardableResult public func advertising(_ advertising: JWAdvertisingConfig) -> JWPlayerConfigurationBuilderParameters
advertisingInformation about ad behavior.
Return Value
The builder, so setters can be chained.
-
Sets the settings for related content.
See also
JWRelatedConfigDeclaration
Swift
@discardableResult public func related(_ related: JWRelatedContentConfiguration) -> JWPlayerConfigurationBuilderParameters
relatedSettings for related content.
Return Value
The builder, so setters can be chained.
-
Sets whether or not a video should start automatically after loading. The default value is
false.Declaration
Swift
@discardableResult public func autostart(_ autostart: Bool) -> JWPlayerConfigurationBuilderParameters
autostartWhether 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. The default value is
JWPreload.auto.Note
JWPreload.autoloads the manifest before playback is requested.Note
JWPreload.nonedoesn’t preload content. We recommend this if you are concerned about excess content usage.Declaration
Swift
@discardableResult public func preload(_ preload: JWPreload) -> JWPlayerConfigurationBuilderParameters
preloadWhether 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) -> JWPlayerConfigurationBuilderParameters
bitrateUpperBoundThe 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. The default value is
false.Declaration
Swift
@discardableResult public func repeatContent(_ repeatContent: Bool) -> JWPlayerConfigurationBuilderParameters
repeatContentWhether 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.See also
JWExternalMetadataDeclaration
Swift
@discardableResult public func externalMetadata(_ externalMetadata: [JWExternalMetadata]) -> JWPlayerConfigurationBuilderParameters
externalMetadataAn 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
@available(iOS 10.0, *) @discardableResult public func adTracker(_ tracker: JWAdTrackerConfig) -> JWPlayerConfigurationBuilderParameters
trackerA config for the desired ad tracker.
-
Defines what settings to use during external playback.
Declaration
Swift
@discardableResult public func externalPlaybackSettings(_ settings: JWExternalPlaybackSettings) -> JWPlayerConfigurationBuilderParameters
settingsThe settings object defining external playback behavior.
-
Allows a configuration to be created using a natively-defined JSONObject.
Warning
If this method is called, it will override any parameters set using other methods in this builder. Callingconfiguration(json: Data)will throw an error whenbuild()is called.Declaration
Swift
@discardableResult public func configuration(json: JSONObject) -> JWPlayerConfigurationBuilderParameters
jsonThe dictionary defining the configuration.
-
Allows a configuration to be created using a data blob containing JSON. If the supplied data cannot be converted into JSON, or the JSON in the data is not formatted correctly, the
build()method will throw an error.Warning
If this method is called, it will override any parameters set using other methods in this builder. Callingconfiguration(json: JSONObject)will throw an error whenbuild()is called.Declaration
Swift
@discardableResult public func configuration(data: Data) -> JWPlayerConfigurationBuilderParameters
dataThe JSON data defining the configuration.
JWPlayerConfigurationBuilder Class Reference