Contents

init(asset:automaticallyLoadedAssetKeys:)

Creates a player item with the specified asset and the asset keys to automatically load.

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