AVQueuePlayer Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 4.1 and later.
Declared in
AVPlayer.h

Overview

AVQueuePlayer is a subclass of AVPlayer you use to play a number of items in sequence.

Tasks

Creating a Queue Player

Managing Items

Class Methods

queuePlayerWithItems:

Returns an instance of AVQueuePlayer initialized to play items from a given array.

+ (AVQueuePlayer *)queuePlayerWithItems:(NSArray *)items
Parameters
items

An array of AVPlayerItem objects with which initially to populate the player’s queue.

Return Value

An instance of AVQueuePlayer initialized to play the player items in items.

Discussion

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h

Instance Methods

advanceToNextItem

Ends playback of the current item and initiates playback of the next item in the player’s queue.

- (void)advanceToNextItem
Discussion

This method also removes the current item from the play queue.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h

canInsertItem:afterItem:

Returns a Boolean value that indicates whether a given player item can be inserted into the player’s queue.

- (BOOL)canInsertItem:(AVPlayerItem *)item afterItem:(AVPlayerItem *)afterItem
Parameters
item

The AVPlayerItem object to test.

afterItem

The item that item is to follow in the queue. Pass nil to test whether item can be appended to the queue.

Return Value

YES if item can be appended to the queue, otherwise NO.

Discussion

Adding the same item to a player at more than one position in the queue is not supported.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h

initWithItems:

Initializes an instance of AVQueuePlayer by enqueueing the player items from a given array.

- (id)initWithItems:(NSArray *)items
Parameters
items

An array of AVPlayerItem objects with which initially to populate the player’s queue.

Return Value

An instance of AVQueuePlayer initialized to play the player items in items.

Discussion

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h

insertItem:afterItem:

Places given player item after a specified item in the queue.

- (void)insertItem:(AVPlayerItem *)item afterItem:(AVPlayerItem *)afterItem
Parameters
item

The item to be inserted.

afterItem

The item that the newly inserted item should follow in the queue. Pass nil to append the item to the queue.

Discussion

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h

items

Returns an array of the currently enqueued items.

- (NSArray *)items
Return Value

An array of the currently enqueued items

Discussion

The array contains AVPlayerItem objects

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h

removeAllItems

Removes all the items from the queue.

- (void)removeAllItems
Discussion

This has the side-effect of stopping playback by the player.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h

removeItem:

Removes a given player item from the queue.

- (void)removeItem:(AVPlayerItem *)item
Parameters
item

The item to be removed.

Discussion

If item is currently playing, this has the same effect as advanceToNextItem.

Availability
  • Available in iOS 4.1 and later.
Declared In
AVPlayer.h