---
title: "enqueue(_:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avqueuedsamplebufferrendering/enqueue(_:)"
---

# enqueue(_:)

Sends a sample buffer to the queue for rendering.

## Declaration

```swift
func enqueue(_ sampleBuffer: CMSampleBuffer)
```

## Parameters

- `sampleBuffer`: The sample buffer to be enqueued.

## Discussion

Discussion For video data, the sample buffer is processed according to the attachments it contains. If it has a true value for its kCMSampleAttachmentKey_DoNotDisplay attachment, the frame is decoded but not displayed. If it has a true value for its kCMSampleAttachmentKey_DisplayImmediately attachment, the frame is displayed as soon as possible, regardless of its presentation timestamp. Otherwise, the frame is displayed according to its presentation timestamp, relative to the timebase. To schedule the removal of previous images at a specific timestamp, enqueue a marker sample buffer that doesn’t contain any samples, with the kCMSampleBufferAttachmentKey_EmptyMedia attachment set to kCFBooleanTrue. important: Attachments with the kCMSampleAttachmentKey_ prefix must be set using CMSampleBufferGetSampleAttachmentsArray(_:createIfNecessary:) and CFDictionarySetValue(_:_:_:).  Attachments with the kCMSampleBufferAttachmentKey_ prefix must be set via CMSetAttachment(_:key:value:attachmentMode:).

## See Also

### Requesting media

- [isReadyForMoreMediaData](avfoundation/avqueuedsamplebufferrendering/isreadyformoremediadata.md)
- [requestMediaDataWhenReady(on:using:)](avfoundation/avqueuedsamplebufferrendering/requestmediadatawhenready(on:using:).md)
- [stopRequestingMediaData()](avfoundation/avqueuedsamplebufferrendering/stoprequestingmediadata().md)
