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

# AVSampleCursor

An object that provides information about the media sample at the cursor’s current position.

```
class AVSampleCursor
```

## Overview

You position a sample cursor at a specific media sample in a sequence of samples contained in a higher-level object, like an [`AVAssetTrack`](/documentation/AVFoundation/AVAssetTrack). You can move it to a new position in that sequence either backwards or forwards, either in decode order or in presentation order. You can also request moving it according to a count of samples or a delta in time.

Use a sample cursor to get information about the media sample such as its duration, timestamps, dependency information, and so on. You can also use them to synchronously to perform I/O in order to load media data of one or more media samples into memory.

## Topics

### Navigating samples

[`step(byDecodeTime:wasPinned:)`](/documentation/AVFoundation/AVSampleCursor/step(byDecodeTime:wasPinned:))

Moves the cursor by a given delta time on the decode timeline.

[`step(byPresentationTime:wasPinned:)`](/documentation/AVFoundation/AVSampleCursor/step(byPresentationTime:wasPinned:))

Moves the cursor by a given delta time on the presentation timeline.

[`stepInDecodeOrder(byCount:)`](/documentation/AVFoundation/AVSampleCursor/stepInDecodeOrder(byCount:))

Moves the cursor a given number of samples in decode order.

[`stepInPresentationOrder(byCount:)`](/documentation/AVFoundation/AVSampleCursor/stepInPresentationOrder(byCount:))

Moves the cursor a given number of samples in presentation order.

### Getting timestamps

[`decodeTimeStamp`](/documentation/AVFoundation/AVSampleCursor/decodeTimeStamp)

The decode timestamp of the sample at the current position of the cursor.

[`presentationTimeStamp`](/documentation/AVFoundation/AVSampleCursor/presentationTimeStamp)

The presentation timestamp of the sample at the current position of the cursor.

### Getting sample information

[`currentChunkInfo`](/documentation/AVFoundation/AVSampleCursor/currentChunkInfo)

A value that provides information about the chunk of samples to which the current sample belongs.

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

A value that provides information about a chunk of media samples.

[`currentChunkStorageRange`](/documentation/AVFoundation/AVSampleCursor/currentChunkStorageRange)

The sample range in the storage container to load together with the current sample as a chunk.

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

A structure that indicates the offset and length of storage for a media sample or its chunk.

[`currentChunkStorageURL`](/documentation/AVFoundation/AVSampleCursor/currentChunkStorageURL)

The URL of the storage container of the current sample and other samples to load in the same operation as a chunk.

[`currentSampleDependencyInfo`](/documentation/AVFoundation/AVSampleCursor/currentSampleDependencyInfo)

The dependency information that describes relationships between a media sample and other media samples in the same sample sequence.

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

A value for describing dependencies between a media sample and other media samples in the same sample sequence.

[`currentSampleDuration`](/documentation/AVFoundation/AVSampleCursor/currentSampleDuration)

The decode duration of the sample at the cursor’s current position.

[`currentSampleIndexInChunk`](/documentation/AVFoundation/AVSampleCursor/currentSampleIndexInChunk)

The index of the current sample within the chunk to which it belongs.

[`currentSampleStorageRange`](/documentation/AVFoundation/AVSampleCursor/currentSampleStorageRange)

The offset and length of the current sample in the current chunk storage URL.

[`currentSampleSyncInfo`](/documentation/AVFoundation/AVSampleCursor/currentSampleSyncInfo)

The synchronization information for the current sample for consideration when resynchronizing a decoder.

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

A structure that describes the attributes of media samples to consider when resynchronizing a decoder.

[`copyCurrentSampleFormatDescription()`](/documentation/AVFoundation/AVSampleCursor/copyCurrentSampleFormatDescription())

Returns the format description of the sample at the cursor’s current position.

[`currentSampleAudioDependencyInfo`](/documentation/AVFoundation/AVSampleCursor/currentSampleAudioDependencyInfo)

The independent decodability information for the audio sample.

[`currentSampleDependencyAttachments`](/documentation/AVFoundation/AVSampleCursor/currentSampleDependencyAttachments)

A dictionary of dependency-related sample buffer attachments.

### Accessing samples

[`maySamplesWithEarlierDecodeTimeStampsHavePresentationTimeStamps(laterThan:)`](/documentation/AVFoundation/AVSampleCursor/maySamplesWithEarlierDecodeTimeStampsHavePresentationTimeStamps(laterThan:))

Determines whether a sample earlier in decode order can have a presentation timestamp later than that of the specified sample cursor.

[`maySamplesWithLaterDecodeTimeStampsHavePresentationTimeStamps(earlierThan:)`](/documentation/AVFoundation/AVSampleCursor/maySamplesWithLaterDecodeTimeStampsHavePresentationTimeStamps(earlierThan:))

Determines whether a sample later in decode order can have a presentation timestamp earlier than that of the specified sample cursor.

[`samplesRequiredForDecoderRefresh`](/documentation/AVFoundation/AVSampleCursor/samplesRequiredForDecoderRefresh)

The number of samples prior to the current sample, in decode order, the decoder requires to achieve a coherent output at the current decode time.

### Comparing sample cursors

[`comparePositionInDecodeOrder(withPositionOf:)`](/documentation/AVFoundation/AVSampleCursor/comparePositionInDecodeOrder(withPositionOf:))

Compares the relative positions of two sample cursors and returns their relative positions.



---

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)