<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayerItemSampleBufferOutput",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVPlayerItemSampleBufferOutput"
  },
  "title" : "AVPlayerItemSampleBufferOutput"
}
-->

# AVPlayerItemSampleBufferOutput

[`AVPlayerItemSampleBufferOutput`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput) delivers `CMSampleBuffers` for [`AVPlayerItem`](/documentation/AVFoundation/AVPlayerItem) playback.

```
class AVPlayerItemSampleBufferOutput
```

## Overview

Playback only happens when the [`AVPlayerItem`](/documentation/AVFoundation/AVPlayerItem) is the current item of its [`AVPlayer`](/documentation/AVFoundation/AVPlayer).

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

Note that [`AVPlayerItemSampleBufferOutput`](/documentation/AVFoundation/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

[`-  initWithConfiguration:`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/init(configuration:))

Initializes an instance of [`AVPlayerItemSampleBufferOutput`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput).

### Configuring the delegate

[`delegate`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/delegate)

The receiver’s delegate.

[`delegateQueue`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/delegateQueue)

The dispatch queue where the delegate is messaged.

[`-  setDelegate:queue:`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/setDelegate:queue:)

Sets the receiver’s delegate and a dispatch queue on which the delegate will be called.

### Retrieving sample buffers

[`nextAvailableSampleBuffer()`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/nextAvailableSampleBuffer())

Returns the next sample buffer if it is already available.

[`nextSampleBuffer()`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/nextSampleBuffer())

Returns next sample buffer once it becomes available.

[`SampleBufferInSequence`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/SampleBufferInSequence)

Holds the information necessary for processing generated sample buffers.

[`-  copyNextSampleBuffer`](/documentation/AVFoundation/AVPlayerItemSampleBufferOutput/copyNextSampleBuffer)

Copies the next sample buffer for the output synchronously.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`AVPlayerItemOutput`](/documentation/AVFoundation/AVPlayerItemOutput)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)