<!--
{
  "availability" : [
    "iOS: 8.0.0 - 27.0.0",
    "iPadOS: 8.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.10.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVAssetReaderOutput/reset(forReadingTimeRanges:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAssetReaderOutput(im)resetForReadingTimeRanges:"
  },
  "title" : "reset(forReadingTimeRanges:)"
}
-->

# reset(forReadingTimeRanges:)

Restarts reading with a new set of time ranges.

```
func reset(forReadingTimeRanges timeRanges: [NSValue])
```

## Parameters

`timeRanges`

An array of <doc://com.apple.documentation/documentation/Foundation/NSValue> objects, each representing a single <doc://com.apple.documentation/documentation/CoreMedia/CMTimeRange> structure.

## Discussion

You may only call this method if the value of the [`supportsRandomAccess`](/documentation/AVFoundation/AVAssetReaderOutput/supportsRandomAccess) property is <doc://com.apple.documentation/documentation/Swift/true>. You can’t call it after invoking [`markConfigurationAsFinal()`](/documentation/AVFoundation/AVAssetReaderOutput/markConfigurationAsFinal()).

A typical time to call this method is when performing multi-pass encoding using an instance of [`AVAssetWriter`](/documentation/AVFoundation/AVAssetWriter). In this case, call the [`copyNextSampleBuffer()`](/documentation/AVFoundation/AVAssetReaderOutput/copyNextSampleBuffer()) method until it returns `nil`, and then ask the asset writer’s input for a set of time ranges to reencode. You pass the time ranges to this method to prepare the output for the next pass.

The time ranges that you set here override the value of the asset reader’s [`timeRange`](/documentation/AVFoundation/AVAssetReader/timeRange) property. If the start times of the time range in the array don’t strictly increase, or if two or more time ranges in the array overlap, the system throws an exception. It’s an error to include a time range with a nonnumeric start time or duration, unless the duration is <doc://com.apple.documentation/documentation/CoreMedia/CMTime/positiveInfinity>.

If you call this method while the asset reader is in an [`AVAssetReader.Status.failed`](/documentation/AVFoundation/AVAssetReader/Status-swift.enum/failed) or [`AVAssetReader.Status.cancelled`](/documentation/AVFoundation/AVAssetReader/Status-swift.enum/cancelled) state, its [`status`](/documentation/AVFoundation/AVAssetReader/status-swift.property) property value doesn’t change, and the result of the next call to [`copyNextSampleBuffer()`](/documentation/AVFoundation/AVAssetReaderOutput/copyNextSampleBuffer()) is `nil`.

If you call this method while there’s still media data to read, the system throws an exception. You can only call it after the asset reader starts reading.

---

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)