Type Method

playerItemWithURL:

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

Declaration

+ (instancetype)playerItemWithURL:(NSURL *)URL;

Parameters

URL

A URL identifying the media resource to be played.

Return Value

A new player item, prepared to use URL.

Discussion

This method immediately returns the item, but with the status AVPlayerItemStatusUnknown.

Associating the player item with an AVPlayer immediately begins enqueuing its media and preparing it for playback. If the URL contains valid data that can be used by the player item, its status later changes to AVPlayerItemStatusReadyToPlay. If the URL contains no valid data or otherwise can't be used by the player item, its status later changes to AVPlayerItemStatusFailed. You can determine the nature of the failure by querying the player item’s error property.

See Also

Creating a Player Item

- initWithURL:

Initializes a player item with 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.

+ playerItemWithAsset:automaticallyLoadedAssetKeys:

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