JWPlayerItemBuilder
@objcMembers
public class JWPlayerItemBuilder : NSObject, JWBuilder
The builder for JWPlayerItem, ensuring it is built correctly.
-
Declaration
Swift
public typealias Output = JWPlayerItem -
Builds a JWPlayerItem modeled after the specified parameters.
Throws
JWError with key propertyNotSetIf at least one video source is not specified.JWError with key ambiguousVideoSourcesIf both a file and a video source are specified.Declaration
Swift
public func build() throws -> JWPlayerItemReturn Value
A JWPlayerItem object with the provided parameters.
-
Sets a single video source for the player item by providing an URL.
Declaration
Swift
@discardableResult public func file(_ file: URL) -> JWPlayerItemBuilderParameters
fileA String to display as title.
Return Value
The builder, so setters can be chained.
-
Sets the title of the player item.
Note
The string provided is displayed as a literal, and is not looked up in a localized string table.Declaration
Swift
@discardableResult public func title(_ title: String) -> JWPlayerItemBuilderParameters
titleA String to display as title.
Return Value
The builder, so setters can be chained.
-
Sets the description of the player item.
Note
The string provided is displayed as a literal, and is not looked up in a localized string table.Declaration
Swift
@discardableResult public func description(_ description: String) -> JWPlayerItemBuilderParameters
descriptionA String to display as description.
Return Value
The builder, so setters can be chained.
-
Sets the poster image url of the player item.
Declaration
Swift
@discardableResult public func posterImage(_ posterImage: URL) -> JWPlayerItemBuilderParameters
posterImageAn URL that points to the poster image.
Return Value
The builder, so setters can be chained.
-
Sets the number of seconds from the start of a media asset when playback should begin.
Declaration
Swift
@discardableResult public func startTime(_ startTime: TimeInterval) -> JWPlayerItemBuilderParameters
startTimeA TimeInterval value in seconds that determines the start of a media asset when playback should begin.
Return Value
The builder, so setters can be chained.
-
Sets the media identifier of the player item.
Declaration
Swift
@discardableResult public func mediaId(_ mediaId: String) -> JWPlayerItemBuilderParameters
mediaIdA String that represents the player item’s media identifier.
Return Value
The builder, so setters can be chained.
-
Sets the recommendations feed url that contains related items for a particular player item.
Declaration
Swift
@discardableResult public func recommendations(_ recommendations: URL) -> JWPlayerItemBuilderParameters
recommendationsAn URL that represent the player item’s recommendations feed.
Return Value
The builder, so setters can be chained.
-
Sets the flag to start playng the player item automatically.
Declaration
Swift
@available(*, deprecated, message: "Instead use JWPlayerConfigurationBuilder.autostart") @discardableResult public func autostart(_ autostart: Bool) -> JWPlayerItemBuilderParameters
autostartA Boolean that determines whether player item should start automatically after loading.
Return Value
The builder, so setters can be chained.
-
Sets the video sources which represent the quality levels of the player item.
Declaration
Swift
@discardableResult public func videoSources(_ videoSources: [JWVideoSource]) -> JWPlayerItemBuilderParameters
videoSourcesAn array of
JWVideoSourceobjects representing multiple quality levels of a video.Return Value
The builder, so setters can be chained.
-
Sets the media tracks which provide captions for different languages or thumbnails images of the player item.
Declaration
Swift
@discardableResult public func mediaTracks(_ mediaTracks: [JWMediaTrack]) -> JWPlayerItemBuilderParameters
mediaTracksAn array of
JWMediaTrackobjects providing captions for different languages or thumbnails images.Return Value
The builder, so setters can be chained.
-
Sets a VMAP URL.
Declaration
Swift
@discardableResult public func adSchedule(vmapURL: URL) -> JWPlayerItemBuilderParameters
vmapURLEither a local or remote URL of the vmap file.
Return Value
The builder, so setters can be chained.
-
Sets the advertising schedule which represents a point in the player item time to play the ad.
Declaration
Swift
@discardableResult public func adSchedule(breaks: [JWAdBreak]) -> JWPlayerItemBuilderParameters
breaksAn array of
JWAdBreakobjects providing captions for different languages or thumbnail images.Return Value
The builder, so setters can be chained.
-
Sets URL asset .
Note
To see available options, refer to Initialization OptionsDeclaration
Swift
@discardableResult public func assetOptions(_ assetOptions: [String : Any]) -> JWPlayerItemBuilderParameters
assetOptionsA Dictionary of URLAsset initialization options.
Return Value
The builder, so setters can be chained.
-
Sets the Google DAI info which contains either a VoD or Live stream.
Declaration
Swift
@discardableResult public func googleDAIStream(_ googleDAIStream: JWGoogleDAIStream) -> JWPlayerItemBuilderParameters
googleDAIStreamA
JWGoogleDAIStreamobject that provide info about either VoD or Live stream.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
Supersedes the external metadata specified in theJWPlayerConfiguration, for this player item.Note
Capped at 5 metadata instances; the instances in excess will be excluded.See also
JWExternalMetadataDeclaration
Swift
@discardableResult public func externalMetadata(_ externalMetadata: [JWExternalMetadata]) -> JWPlayerItemBuilderReturn Value
The builder, so setters can be chained.
-
Sets the skippable time ranges within the item.
Declaration
Swift
@available(tvOS 14, *) @available(iOS, unavailable) @discardableResult func skippableTimeRanges(_ timeRanges: [JWSkippableTimeRange]) -> JWPlayerItemBuilderParameters
timeRangesThe time ranges which the user can skip.
Return Value
The builder, so setters can be chained.
JWPlayerItemBuilder Class Reference