---
title: "sampleSize(at:)"
framework: coremedia
role: symbol
role_heading: Instance Method
path: "coremedia/cmsamplebuffer/samplesize(at:)"
---

# sampleSize(at:)

Returns the size of a sample in bytes.

## Declaration

```swift
func sampleSize(at sampleIndex: Int) -> Int
```

## Parameters

- `sampleIndex`: The index of the sample to query.

## Return Value

Return Value The size of the sample.

## Discussion

Discussion If you specify a sample index that isn’t in the range, the system returns 0. It also returns 0 if the sample buffer contains no sizes, which occurs if the samples in the buffer are noncontiguous, such as noninterleaved audio, or if the sample buffer contains a CVImageBuffer.

## See Also

### Inspecting Size Information

- [numSamples](coremedia/cmsamplebuffer/numsamples.md)
- [sampleSizes()](coremedia/cmsamplebuffer/samplesizes().md)
- [totalSampleSize](coremedia/cmsamplebuffer/totalsamplesize.md)
