---
title: "insertTimeRange(_:of:at:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avmutablecompositiontrack/inserttimerange(_:of:at:)"
---

# insertTimeRange(_:of:at:)

Inserts a time range of media from a source track into a composition track.

## Declaration

```swift
func insertTimeRange(_ timeRange: CMTimeRange, of track: AVAssetTrack, at startTime: CMTime) throws
```

## Parameters

- `timeRange`: The time range of media in the source track to add.
- `track`: The source asset track that contains the media to add.
- `startTime`: A start time within the composition track to insert the time range.

## Discussion

Discussion The time range you insert presents at its natural duration and rate. If necessary, you can scale it to a different duration by calling the scaleTimeRange(_:toDuration:) method.

## See Also

### Managing time ranges

- [segments](avfoundation/avmutablecompositiontrack/segments.md)
- [insertEmptyTimeRange(_:)](avfoundation/avmutablecompositiontrack/insertemptytimerange(_:).md)
- [insertTimeRanges(_:of:at:)](avfoundation/avmutablecompositiontrack/inserttimeranges(_:of:at:).md)
- [removeTimeRange(_:)](avfoundation/avmutablecompositiontrack/removetimerange(_:).md)
- [scaleTimeRange(_:toDuration:)](avfoundation/avmutablecompositiontrack/scaletimerange(_:toduration:).md)
