A mutable track in a composition object that you use to insert, remove, and scale track segments without affecting their low-level representation.


class AVMutableCompositionTrack : AVCompositionTrack


AVCompositionTrack defines constraints for the temporal alignment of the track segments. If you set the array of track segments in a mutable composition (see segments), you can test whether the segments meet the constraints using validateSegments(_:).


Configuring Track Properties

var languageCode: String?

The language associated with the track, as an ISO 639-2/T language code.

var extendedLanguageTag: String?

The language tag associated with the track, as an RFC 4646 language tag.

var naturalTimeScale: CMTimeScale

The time scale in which time values for the track can be operated upon without extraneous numerical conversion.

var preferredTransform: CGAffineTransform

The preferred transformation of the visual media data for display purposes.

var preferredVolume: Float

The preferred volume of the audible media data.

Associating Tracks

func addTrackAssociation(to: AVCompositionTrack, type: AVAssetTrack.AssociationType)

Establishes a track association of a specific type between two tracks.

struct AVAssetTrack.AssociationType

Constants for identifying how other tracks are associated with a track.

Managing Time Ranges

func insertEmptyTimeRange(CMTimeRange)

Adds or extends an empty time range within the receiver.

func insertTimeRange(CMTimeRange, of: AVAssetTrack, at: CMTime)

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

func insertTimeRanges([NSValue], of: [AVAssetTrack], at: CMTime)

Inserts the time ranges of multiple source tracks into a track of a composition.

func removeTimeRange(CMTimeRange)

Removes a specified time range from the receiver.

func scaleTimeRange(CMTimeRange, toDuration: CMTime)

Changes the duration of a time range in the receiver.

var segments: [AVCompositionTrackSegment]!

The track segments from a composition track.

Validating Segments

func validateSegments([AVCompositionTrackSegment])

Returns a Boolean value that indicates whether a given array of track segments conform to the timing rules for a composition track.

Instance Properties


Inherits From

Conforms To

See Also

Media Composition

class AVComposition

An object that combines media data from multiple file-based sources to present or process media data from multiple sources.

class AVCompositionTrack

A track in a composition object, consisting of a media type, a track identifier, and track segments.

class AVCompositionTrackSegment

A segment of a track, consisting of a URL, a track identifier, and a time mapping from the source track to the composition track.

class AVMutableComposition

A mutable object used to create a new composition from existing assets.