Platforms to show: All Mac Windows Linux Cross-Platform

AVPlayerMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class AVFoundation MBS AVFoundation Plugin 13.2 Yes No No Yes, macOS only No
Function: You use an AVPlayer object to implement controllers and user interfaces for single- or multiple-item playback.
The multiple-item case supports advanced behaviors.

AVPlayer works equally well with local and remote media files, providing you with appropriate information about readiness to play or about the need to await additional data before continuing.

You can display the visual content of items played by an instance of AVPlayer in a CoreAnimation layer of class AVPlayerLayer; to synchronize real-time playback with other CoreAnimation layers, you can use AVSynchronizedLayer. You cannot use an instance of AVVideoCompositionCoreAnimationTool with an AVPlayer object; for offline rendering you should instead use AVAssetExportSession.

You can observe the status of a player using key-value observing. So that you can add and remove observers safely, AVPlayer serializes notifications of changes that occur dynamically during playback on a dispatch queue. By default, this queue is the main queue . To ensure safe access to a player's nonatomic properties while dynamic changes in playback state may be reported, you must serialize access with the receiver's notification queue. In the common case, such serialization is naturally achieved by invoking AVPlayer's various methods on the main thread or queue.

Feedback, Comments & Corrections

Actions for the item end Constants

Constant Value Description
AVPlayerActionAtItemEndAdvance 0 Indicates that the player should advance to the next item, if there is one.
AVPlayerActionAtItemEndNone 2 Indicates that the player should do nothing.
AVPlayerActionAtItemEndPause 1 Indicates that the player should pause playing.

Status Constants

Constant Value Description
AVPlayerStatusFailed 2 Indicates that the player can no longer play AVPlayerItem instances because of an error.
The error is described by the value of the player's error property.
AVPlayerStatusReadyToPlay 1 Indicates that the player is ready to play AVPlayerItem instances.
AVPlayerStatusUnknown 0 Indicates that the status of the player is not yet known because it has not tried to load new media resources for playback.

Sub classes:

Some methods using this class:

Some properties using for this class:

Some events for this class:

Some examples which use this class:

Blog Entries

Xojo Developer Magazine

The items on this page are in the following plugins: MBS AVFoundation Plugin.

AVPlayerLayerMBS   -   AVPlayerMediaSelectionCriteriaMBS

The biggest plugin in space...

MBS Xojo tutorial videos