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.
Declaration
init(player: AVQueuePlayer, templateItem itemToLoop: AVPlayerItem, timeRange loopRange: CMTimeRange, existingItemsOrdering itemOrdering: AVPlayerLooper.ItemOrdering)Parameters
- player:
A queue player to control playback.
- itemToLoop:
A player item to loop.
- loopRange:
The player item time range to loop. Passing a value of Invalid is equivalent to a time range of [0, player item’s duration].
- itemOrdering:
A value that indicates whether the looper inserts replica items before or after existing items in the specified queue player.
Discussion
The player looper doesn’t use the player item you specify for playback, and instead uses it as a template to create at least three player item replicas that it uses for looping playback. Because the looper only uses the player item as a template, any changes that you make to it after initialization aren’t reflected in the looping playback.