<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVMutableMovieTrack/insertMediaTimeRange(_:into:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVMutableMovieTrack(im)insertMediaTimeRange:intoTimeRange:"
  },
  "title" : "insertMediaTimeRange(_:into:)"
}
-->

# insertMediaTimeRange(_:into:)

Inserts a reference to a media time range into a track.

```
func insertMediaTimeRange(_ mediaTimeRange: CMTimeRange, into trackTimeRange: CMTimeRange) -> Bool
```

## Parameters

`mediaTimeRange`

The presentation time range of the media to be inserted.

`trackTimeRange`

The time range of the track into which the media is to be inserted.

## Return Value

A Boolean value that indicates whether the insertion was successful.

## Discussion

Use this method after appending samples or sample references to a track’s media. To specify that the media time range be played at its natural rate, pass `mediaTimeRange.duration == trackTimeRange.duration`; otherwise, the ratio between these is used to determine the playback rate. Pass <doc://com.apple.documentation/documentation/CoreMedia/CMTime/invalid> for `trackTimeRange.start` to indicate that the segment should be appended to the end of the track.

---

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)