---
title: "init(url:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avplayeritem/init(url:)-1xrtk"
---

# init(url:)

Creates a player item with a specified URL.

## Declaration

```swift
nonisolated convenience init(url URL: URL)
```

## Parameters

- `URL`: A URL identifying the media resource to be played.

## Return Value

Return Value A new player item, prepared to use URL.

## Discussion

Discussion 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:)](avfoundation/avplayeritem/init(asset:)-87rjl.md)
- [init(asset:)](avfoundation/avplayeritem/init(asset:)-1nme9.md)
- [init(asset:automaticallyLoadedAssetKeys:)](avfoundation/avplayeritem/init(asset:automaticallyloadedassetkeys:)-5czjh.md)
- [init(asset:automaticallyLoadedAssetKeys:)](avfoundation/avplayeritem/init(asset:automaticallyloadedassetkeys:)-85hal.md)
- [init(asset:automaticallyLoadedAssetKeys:)](avfoundation/avplayeritem/init(asset:automaticallyloadedassetkeys:)-8x4.md)
