---
title: "scaleTimeRange(_:toDuration:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avmutablecomposition/scaletimerange(_:toduration:)"
---

# scaleTimeRange(_:toDuration:)

Changes the duration of all tracks in a given time range.

## Declaration

```swift
func scaleTimeRange(_ timeRange: CMTimeRange, toDuration duration: CMTime)
```

## Parameters

- `timeRange`: The time range of the composition to scale.
- `duration`: The new time range duration.

## Discussion

Discussion A composition presents each track segment affected by the scaling operation at a rate equal to source.duration / target.duration of its resulting time mapping.

## See Also

### Managing time ranges

- [removeTimeRange(_:)](avfoundation/avmutablecomposition/removetimerange(_:).md)
- [insertEmptyTimeRange(_:)](avfoundation/avmutablecomposition/insertemptytimerange(_:).md)
- [insertTimeRange(_:of:at:completionHandler:)](avfoundation/avmutablecomposition/inserttimerange(_:of:at:completionhandler:).md)
- [insertTimeRange(_:of:at:)](avfoundation/avmutablecomposition/inserttimerange(_:of:at:).md)
