Initializer

init(asset:automaticallyLoadedAssetKeys:)

Initializes a player item with the specified asset and the asset keys to be automatically loaded.

Declaration

init(asset: AVAsset, automaticallyLoadedAssetKeys: [String]?)

Parameters

asset

An instance of AVAsset.

automaticallyLoadedAssetKeys

An array of strings, each representing a property defined by AVAsset.

Return Value

An initialized instance of AVPlayerItem.

Discussion

The value of each key in automaticallyLoadedAssetKeys will automatically be loaded by the underlying AVAsset before the player item achieves the status AVPlayerItem.Status.readyToPlay; i.e. when the item is ready to play, the value returned by invoking the asset property’s statusOfValue(forKey:error:) method will be one of the terminal status values, either AVKeyValueStatus.loaded, AVKeyValueStatus.failed, or AVKeyValueStatus.cancelled.

See Also

Creating a Player Item

init(url: URL)

Initializes a player item with a given URL.

init(asset: AVAsset)

Initializes a new player item for a given asset.