<!--
{
  "availability" : [
    "iOS: 4.3.0 -",
    "iPadOS: 4.3.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayerItem/duration",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVPlayerItem(py)duration"
  },
  "title" : "duration"
}
-->

# duration

The duration of the item.

```
nonisolated var duration: CMTime { get }
```

## Discussion

This property indicates the duration of the item, not considering either its [`forwardPlaybackEndTime`](/documentation/AVFoundation/AVPlayerItem/forwardPlaybackEndTime) or [`reversePlaybackEndTime`](/documentation/AVFoundation/AVPlayerItem/reversePlaybackEndTime).

The system reports the value of this property as <doc://com.apple.documentation/documentation/CoreMedia/CMTime/indefinite> until it loads the duration of the underlying asset. There are two ways to make sure you don’t access the value of duration until the system makes it available:

- Wait until the [`status`](/documentation/AVFoundation/AVPlayerItem/status-swift.property) of the player item is [`AVPlayerItem.Status.readyToPlay`](/documentation/AVFoundation/AVPlayerItem/Status-swift.enum/readyToPlay).
- Register for key-value observation of the property and request the initial value. If the system reports the initial value as <doc://com.apple.documentation/documentation/CoreMedia/CMTime/indefinite>, wait for the player item to notify you when [`duration`](/documentation/AVFoundation/AVPlayerItem/duration) becomes available.

> Note:
> The value of ``doc://com.apple.avfoundation/documentation/AVFoundation/AVPlayerItem/duration`` may remain <doc://com.apple.documentation/documentation/CoreMedia/CMTime/indefinite> for live streams.

---

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)