<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayerLooper",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVPlayerLooper"
  },
  "title" : "AVPlayerLooper"
}
-->

# AVPlayerLooper

An object that loops media content using a queue player.

```
class AVPlayerLooper
```

## Overview

You can manually implement looping playback in your app using [`AVQueuePlayer`](/documentation/AVFoundation/AVQueuePlayer), but `AVPlayerLooper` provides a much simpler interface to loop a single [`AVPlayerItem`](/documentation/AVFoundation/AVPlayerItem). You create a player looper by passing it a reference to your [`AVQueuePlayer`](/documentation/AVFoundation/AVQueuePlayer) and a template [`AVPlayerItem`](/documentation/AVFoundation/AVPlayerItem) and the looper automatically manages the looping playback of this content (see example).

```swift
let asset = // AVAsset with its 'duration' property value loaded
let playerItem = AVPlayerItem(asset: asset)
 
// Create a new player looper with the queue player and template item
playerLooper = AVPlayerLooper(player: queuePlayer, templateItem: playerItem)
 
// Begin looping playback
queuePlayer.play()
```

## Topics

### Creating a player looper

[`init(player:templateItem:timeRange:existingItemsOrdering:)`](/documentation/AVFoundation/AVPlayerLooper/init(player:templateItem:timeRange:existingItemsOrdering:))

Creates a player looper that continuously plays the full duration of a player item while adhering to the specified ordering of existing items in the queue.

[`init(player:templateItem:)`](/documentation/AVFoundation/AVPlayerLooper/init(player:templateItem:))

Creates a player looper that continuously plays the full duration of a player item.

[`init(player:templateItem:timeRange:)`](/documentation/AVFoundation/AVPlayerLooper/init(player:templateItem:timeRange:))

Creates a player looper that continuously plays the specified time range of a player item.

[`playerLooperWithPlayer:templateItem:timeRange:`](/documentation/AVFoundation/AVPlayerLooper/playerLooperWithPlayer:templateItem:timeRange:)

Returns player looper that continuously plays the specified time range of a player item.

### Configuring looping

[`loopingPlayerItems`](/documentation/AVFoundation/AVPlayerLooper/loopingPlayerItems)

An array containing replicas of the template player item used to accomplish the looping.

[`disableLooping()`](/documentation/AVFoundation/AVPlayerLooper/disableLooping())

Disables looping for the player queue.

### Observing looping state

[`loopCount`](/documentation/AVFoundation/AVPlayerLooper/loopCount)

The number of times the object played the media.

[`status`](/documentation/AVFoundation/AVPlayerLooper/status-swift.property)

A status that indicates the object’s ability to loop playback.

[`AVPlayerLooper.Status`](/documentation/AVFoundation/AVPlayerLooper/Status-swift.enum)

Status constants that indicate whether a looper can successfully perform looping playback.

### Monitoring errors

[`error`](/documentation/AVFoundation/AVPlayerLooper/error)

An error that describes the reason looping failed.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)