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


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



An instance of AVAsset.


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

Return Value

An initialized instance of AVPlayerItem.


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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software