Contents

AVPlayerItemSampleBufferOutput

Avplayeritemsamplebufferoutput delivers CMSampleBuffers for Avplayeritem playback.

Declaration

class AVPlayerItemSampleBufferOutput

Overview

Playback only happens when the AVPlayerItem is the current item of its AVPlayer.

Create an AVPlayerItemSampleBufferOutput with a AVPlayerItemSampleBufferOutputAudioConfiguration to configure it to deliver CMSampleBuffers containing the decoded audio, and attach it to the AVPlayerItem using -[AVPlayerItem addOutput:]; the audio will be in the format specified by the configuration object’s requestedAudioFormat.

Note that AVPlayerItemSampleBufferOutput may be used to pull CMSampleBuffers far ahead of the current play time. Practical use requires clients to monitor the item timebase time, and pause pulling when they have received CMSampleBuffers sufficient to prepare for near-term-future playback or processing.

Marker-only CMSampleBuffers may be among those returned; you can detect and skip these by testing whether CMSampleBufferGetNumSamples(sampleBuffer) == 0.

The output CMSampleBuffers will have appropriate OutputPresentationTimeStamps for playback, but beyond that, synchronizing presentation to the AVPlayerItem’s timebase is entirely up to the client.

Currently supported for HLS AVPlayerItems only, and only for delivering decoded PCM audio.

Topics

Creating a sample buffer output

Retrieving sample buffers

See Also

Media output