Class

AVSampleBufferDisplayLayer

An object that displays compressed or uncompressed video frames.

Topics

Initiating Media Data Requests

func requestMediaDataWhenReady(on: DispatchQueue, using: () -> Void)

Instructs the target to invoke a client-supplied block repeatedly, at its convenience, in order to gather sample buffers for display.

var isReadyForMoreMediaData: Bool

A Boolean value that indicates the readiness of the layer to accept more sample buffers.

func stopRequestingMediaData()

Cancels any current media data request.

Flushing Sample Buffers

func flush()

Instructs the layer to discard enqueued sample buffers that are pending.

func flushAndRemoveImage()

Instructs the layer to discard pending enqueued sample buffers and remove any currently displayed image.

Configuring the Timebase

var controlTimebase: CMTimebase?

The layer's control timebase, which governs how timestamps are interpreted.

Enqueuing the Sample Buffer

func enqueue(CMSampleBuffer)

Sends a sample buffer for display.

Setting the Video Gravity

var videoGravity: AVLayerVideoGravity

A string defining how the video is displayed within the bounds rect of a sample buffer display layer.

struct AVLayerVideoGravity

A value that defines how the video is displayed within a layer’s bounds rectangle.

Getting Display Layer Settings

var status: AVQueuedSampleBufferRenderingStatus

The ability of the display layer to be used for enqueuing sample buffers.

var error: Error?

Returns the error if the status indicates failure.

Constants

enum AVQueuedSampleBufferRenderingStatus

Constants that describe the possible values of the status property.

AVSampleBufferDisplayLayerFailedToDecodeNotificationErrorKey

Constant that describes the key for the userInfo field in the AVSampleBufferDisplayLayerFailedToDecode notification.

Notifications

static let AVSampleBufferDisplayLayerFailedToDecode: NSNotification.Name

Posted when a buffer display layer failed to decode.

See Also

Media Playback

class AVPlayer

An object that provides the interface to control the player’s transport behavior.

class AVQueuePlayer

A player used to play a number of items in sequence.

class AVPlayerLayer

An object that manages a player's visual output.

class AVPlayerItem

An object used to model the timing and presentation state of an asset played by the player.

class AVPlayerItemTrack

An object used to modify the presentation state of an asset track being presented by a player.

class AVSynchronizedLayer

An object used to synchronize with a specific player item.

class AVPlayerItemMetadataCollector

An object used to capture the date range metadata defined for an HTTP Live Streaming asset.

class AVPlayerMediaSelectionCriteria

An object that specifies the preferred languages and media characteristics for a player.

class AVSampleBufferAudioRenderer

An object used to decompress audio and play compressed or uncompressed audio.

class AVSampleBufferRenderSynchronizer

An object used to synchronize multiple queued sample buffers to a single timeline.