Type Method

playerItemWithAsset:automaticallyLoadedAssetKeys:

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

Declaration

+ (instancetype)playerItemWithAsset:(AVAsset *)asset automaticallyLoadedAssetKeys:(NSArray<NSString *> *)automaticallyLoadedAssetKeys;

Parameters

asset

An instance of AVAsset.

automaticallyLoadedAssetKeys

An array of strings, each representing a property key 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 AVPlayerItemStatusReadyToPlay; i.e. when the item is ready to play, the value returned by invoking the asset property’s statusOfValueForKey:error: method will be one of the terminal status values, either AVKeyValueStatusLoaded, AVKeyValueStatusFailed, or AVKeyValueStatusCancelled.

See Also

Creating a Player Item

- initWithURL:

Initializes a player item with a given URL.

+ playerItemWithURL:

Returns a new player item, prepared to use a given URL.

- initWithAsset:

Initializes a new player item for a given asset.

+ playerItemWithAsset:

Returns a new player item for a given asset.

- initWithAsset:automaticallyLoadedAssetKeys:

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

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