To add a time range to an AVMutableCompositionTrack you have to specify the start time in the track (at:
)...
try track?.insertTimeRange(CMTimeRangeMake(start: CMTime.zero,
duration: CMTime(seconds: 2, preferredTimescale: CMTimeScale(1))),
of: asset.tracks(withMediaType: .video)[0],
at: composition.duration)
Let's say I have several tracks in a mutable composition such that their time ranges play in a sequence with no gaps. If I remove, say, the second track, then do all the following tracks need to have their start time manually updated? Similarly, do all the track instructions need to be updated too? Or is there a way of having this happen automatically?