---
title: "init(url:trackID:sourceTimeRange:targetTimeRange:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avcompositiontracksegment/init(url:trackid:sourcetimerange:targettimerange:)-4rc2g"
---

# init(url:trackID:sourceTimeRange:targetTimeRange:)

Creates an object that presents a segment of a media file that the specified URL references.

## Declaration

```swift
init(url URL: URL, trackID: CMPersistentTrackID, sourceTimeRange: CMTimeRange, targetTimeRange: CMTimeRange)
```

## Parameters

- `URL`: A URL of the source media file.
- `trackID`: The identifier of the track whose media this segment presents.
- `sourceTimeRange`: The time range of the track whose media this segment presents.
- `targetTimeRange`: The time range of the composition track to present the segment’s media.

## See Also

### Creating a segment

- [init(timeRange:)](avfoundation/avcompositiontracksegment/init(timerange:).md)
