JWPlayerItem
@objcMembers
public final class JWPlayerItem : NSObject, JWJSONEncodable, JWInitializableFromJSON
Defines a player item which contains the information about the media content.
-
Title of the player item.
Declaration
Swift
public internal(set) var title: String? { get } -
Short description of the player item.
Declaration
Swift
public override var description: String { get } -
Poster image url of the player item.
Declaration
Swift
public internal(set) var posterImage: URL? { get } -
Number of seconds from the start of a media asset when playback should begin.
Declaration
Swift
public internal(set) var startTime: TimeInterval { get } -
The player item’s media identifier.
Declaration
Swift
public internal(set) var mediaId: String? { get } -
URL to a feed that contains related items for a particular player item.
Declaration
Swift
public internal(set) var recommendations: URL? { get } -
An array of
JWVideoSourceobjects representing multiple quality levels of a video.Seealso
JWVideoSourceDeclaration
Swift
public internal(set) var videoSources: [JWVideoSource]! { get } -
An array of
JWMediaTrackobjects providing captions for different languages or thumbnails images.Seealso
JWMediaTrackDeclaration
Swift
public internal(set) var mediaTracks: [JWMediaTrack]? { get } -
The XML of the VMAP to load.
Note
Used for JW.Declaration
Swift
public internal(set) var vmapXML: String? { get } -
The URL of the VMAP file to load.
Note
Used for JW and IMA.Declaration
Swift
public internal(set) var vmapURL: URL? { get } -
A
JWGoogleDAIStreamobject that provides info about either a VoD or Live stream.Seealso
JWGoogleDAIStreamDeclaration
Swift
public internal(set) var googleDAIStream: JWGoogleDAIStream? { get } -
A dictionary that contains options used to customize the initialization of the asset.
Note
For more information, refer to Initialization OptionsDeclaration
Swift
public internal(set) var assetOptions: [String : Any]? { get } -
Array of metadata that an 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
public internal(set) var externalMetadata: [JWExternalMetadata]? { get } -
The target distance from the live edge, in seconds, during live stream playback.
When set to a value between 5 and 45, the player targets this many seconds behind the live edge. This is useful when captions or other synchronized content require additional processing time that exceeds the player’s default proximity to the live edge.
A value of
0(the default), a negative value, or a non-finite value leaves the live edge targeting at the platform’s native default. Positive values are clamped to the 5–45 second range.Note
This property only affects live streams. For VOD content it is ignored.Note
This is a target, not a guarantee. Many live streams advertise a minimum hold-back from the live edge (the stream’s recommended offset); the player cannot position closer to the live edge than that minimum, so a value smaller than the stream’s hold-back has no visible effect. Requesting a larger offset than the stream’s hold-back is honored. The exact minimum is stream-specific and not known in advance.Note
Internally maps toAVPlayerItem.configuredTimeOffsetFromLive, and the player also enablesautomaticallyPreservesTimeOffsetFromLivefor automatic recovery after stalls.Warning
Setting a large offset increases the delay between the real-time broadcast and what the viewer sees. Only increase this value if you have a specific need (e.g., caption synchronization). Using values above 30 seconds may noticeably degrade the viewer’s sense of “liveness” and can increase memory usage for the playback buffer.Important
WhenliveSyncDurationis set, the player’s steady-state position will be approximately this many seconds behind the true live edge. The SDK’s built-in live UI (the “Live” indicator and “Go to Live” button) accounts for this offset automatically.Declaration
Swift
public internal(set) var liveSyncDuration: TimeInterval { get } -
Custom attributes that you can associate with the item.
Use this property to attach a value that provides additional context to the media item. For example, you can attach flags for filtering logic elsewhere in the app, or additional JSON data to be included when serializing the item to be sent over the network, such as credentials for DRM casting to a Chromecast receiver.
Declaration
Swift
public internal(set) var userInfo: JSONObject? { get }
-
Returns a chapter track, if it exists.
Declaration
Swift
public var chapterTrack: JWChapterTrack? { get } -
Returns the captions tracks, if they exist.
Declaration
Swift
public var captionTracks: [JWCaptionTrack] { get } -
Returns a thumbnail track, if it exists.
Declaration
Swift
public var thumbnailTrack: JWMediaTrack? { get } -
Undocumented
Declaration
Swift
public override func copy() -> Any -
Overridden to check quickly and accurately if two player items are the same.
Declaration
Swift
public override func isEqual(_ object: Any?) -> Bool
-
Declaration
Swift
public func toJSONObject() -> JSONObject
-
Calling this method converts the
JSONObjectinto aJWPlayerItem.Declaration
Swift
public static func from(json: JSONObject) -> `Self`?Return Value
A
JWPlayerItem, ornilif it does not succeed.