<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayerItem/init(asset:automaticallyLoadedAssetKeys:)-8x4",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVPlayerItem(im)initWithAsset:automaticallyLoadedAssetKeys:"
  },
  "title" : "init(asset:automaticallyLoadedAssetKeys:)"
}
-->

# init(asset:automaticallyLoadedAssetKeys:)

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

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

## Parameters

`asset`

An instance of [`AVAsset`](/documentation/AVFoundation/AVAsset).

`automaticallyLoadedAssetKeys`

An array of strings, each representing a property defined by [`AVAsset`](/documentation/AVFoundation/AVAsset).

## Return Value

An initialized instance of `AVPlayerItem`.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)