---
title: "canInsert(_:after:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avqueueplayer/caninsert(_:after:)"
---

# canInsert(_:after:)

Returns a Boolean value that indicates whether you can insert a player item into the player’s queue.

## Declaration

```swift
nonisolated func canInsert(_ item: AVPlayerItem, after afterItem: AVPlayerItem?) -> Bool
```

## Parameters

- `item`: The player item to insert.
- `afterItem`: The player item in the queue to follow. Pass nil to test if you can append the item to the queue.

## Return Value

Return Value true if item can be appended to the queue, otherwise false.

## Discussion

Discussion Adding the same item to a player at more than one position in the queue isn’t supported.

## See Also

### Managing the player queue

- [items()](avfoundation/avqueueplayer/items().md)
- [advanceToNextItem()](avfoundation/avqueueplayer/advancetonextitem().md)
- [insert(_:after:)](avfoundation/avqueueplayer/insert(_:after:).md)
- [remove(_:)](avfoundation/avqueueplayer/remove(_:).md)
- [removeAllItems()](avfoundation/avqueueplayer/removeallitems().md)
