Initializes a player item with a given URL.


convenience init(url URL: URL)



A URL identifying the media resource to be played.

Return Value

A new player item, prepared to use URL.


This method immediately returns the item, but with the status AVPlayerItem.Status.unknown.

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 AVPlayerItem.Status.readyToPlay. If the URL contains no valid data or otherwise can't be used by the player item, its status later changes to AVPlayerItem.Status.failed. You can determine the nature of the failure by querying the player item’s error property.

See Also

Creating a Player Item

init(asset: AVAsset)

Initializes a new player item for a given asset.

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

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