AVPlayerLooper
An object that loops media content using a queue player.
Declaration
class AVPlayerLooperOverview
You can manually implement looping playback in your app using AVQueuePlayer, but AVPlayerLooper provides a much simpler interface to loop a single AVPlayerItem. You create a player looper by passing it a reference to your AVQueuePlayer and a template AVPlayerItem and the looper automatically manages the looping playback of this content (see example).
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:)init(player:templateItem:)init(player:templateItem:timeRange:)