init(asset:automaticallyLoadedAssetKeys:)
Creates a player item for the asset, and automatically loads values for the specified properties.
Declaration
@MainActor @preconcurrency convenience init(asset: AVAsset, automaticallyLoadedAssetKeys: [AVPartialAsyncProperty<AVAsset>] = [])Parameters
- asset:
The asset to play.
- automaticallyLoadedAssetKeys:
An array of property identifiers for which the system automatically loads a value.
Discussion
The system automatically loads values for the specified property identifiers before the player item reaches an AVPlayerItem.Status.readyToPlay state. In this state, calling status(of:) on a specified property identifier returns a value of AVAsyncProperty.Status.loaded(_:) or AVAsyncProperty.Status.failed(_:).