<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ImmersiveMediaSupport",
  "identifier" : "/documentation/ImmersiveMediaSupport/PresentationDescriptorReader/metadataTrack(timeRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Immersive Media Support"
    ],
    "preciseIdentifier" : "s:21ImmersiveMediaSupport28PresentationDescriptorReaderC13metadataTrack9timeRangeSaySo14AVMetadataItemCGSo06CMTimeJ0aSg_tKF"
  },
  "title" : "metadataTrack(timeRange:)"
}
-->

# metadataTrack(timeRange:)

Retrieves all metadata items to write to an output metadata track, optionally clipped
to a segment time range. Pass a `timeRange` to produce one item per segment (e.g. per
IDR group or per fixed-length interval).

```
func metadataTrack(timeRange: CMTimeRange? = nil) throws -> [AVMetadataItem]
```

## Parameters

`timeRange`

The segment range to filter to, or `nil` to return all items.

## Return Value

An array of `AVMetadataItem` objects sorted by start time.

## Discussion

Note: the last item’s `duration` may be invalid, since the descriptor itself doesn’t
know where the video ends. If you need a concrete duration (e.g. to extend the final
segment to the end of the video), copy the returned item and overwrite `duration` with
the valid value. Also, use the same timescale for `timeRange` as the
[`PresentationCommand`](/documentation/ImmersiveMediaSupport/PresentationCommand) values to avoid timescale mismatches.

---

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)